ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - LeeroyDing/json_logger: Simple JSON Logger for Elixir apps.
Simple JSON Logger for Elixir apps. Contribute to LeeroyDing/json_logger development by creating an account on GitHub.
Visit Site

GitHub - LeeroyDing/json_logger: Simple JSON Logger for Elixir apps.

GitHub - LeeroyDing/json_logger: Simple JSON Logger for Elixir apps.

Elixir JSON Logger

JSON Logger is a logger backend that outputs elixir logs in JSON format.

This project is originally designed to make Elixir apps work with Logstash easily. It aims at providing as much information for the log is possible, so the logs can be more easily analyzed by backend services like Elasticsearch.

Issues and PRs are welcome.

Dependencies

This project requires json.

Configuration

Elixir Project

JSON Logger currently provides very few options:

  • level: The minimal level of logging. There's no default of this option. Example: level: :warn
  • output: The output of the log. Must be either :console or {:udp, host, port} or {:tcp, host, port}. Example: output: {:udp, "localhost", 514}`
  • metadata: Whatever else you want in the log. Example: metadata: "Some very important project"

Example configuration: config :logger, :json_logger, level: :info, output: {:udp, "localhost", 514}

TCP support is still experimental, please submit issues that you encounter.

In your application

You should add json_logger to your mix.exs as well. This step may not be necessary (if you know why please tell me).

defmodule MyMod.Mixfile do
  # ...
  def application do
    [applications: [:logger, :json_logger],
     mod: {MyMod, []}]
  end
  # ...
end

Adding the logger backend

You need to add this backend to your Logger, preferably put this in your Application's start/2.

Logger.add_backend Logger.Backends.JSON

If you wish to use Logstash with this library

Here is an example logstash configuration:

input {
  udp {
    port => 514
    type => "elixir_json_logging"
  }
}

filter {
  json {
    source => "message"
  }
}

output {
  stdout {
    codec => rubydebug
  }
}

Note that this configuration will probably break on your system (listening to a <1024 port). You should change the "port" to a larger value.

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory