Giter Club home page Giter Club logo

logger_logstash_backend's Introduction

Fork of LoggerLogstashBackend

About

A backend for the Elixir Logger that will send logs to the Logstash UDP input in flat JSON format.

Supported options

  • host: String.t. The hostname or ip address where to send the logs.
  • port: Integer. The port number. Logstash should be listening with its UDP inputter.
  • metadata: Keyword.t. Extra fields to be added when sending the logs. These will be merged with the metadata sent in every log message.
  • level: Atom. Minimum level for this backend.
  • type: String.t. Type of logs. Useful to filter in logstash.

Sample Logstash config

input {
  udp {
    codec => json
    port => 10001
    queue_size => 10000
    workers => 10
    type => default_log_type
  }
}
output {
  stdout {}
  elasticsearch {
    protocol => http
  }
}

Using it with Mix

To use it in your Mix projects, first add it as a dependency:

def deps do
  [{:logger_logstash_backend, "~> 3.0.0"}]
end

Then run mix deps.get to install it.

Add logger and tzdata as applications:

def application do
  [applications: [:logger, :timex]]
end

Configuration Examples

Runtime

Logger.add_backend {LoggerLogstashBackend, :debug}
Logger.configure {LoggerLogstashBackend, :debug},
  host: "127.0.0.1",
  port: 10001,
  level: :debug,
  metadata: ...

Application config

config :logger,
  backends: [{LoggerLogstashBackend, :error_log}, :console]

config :logger, :error_log,
  host: "some.host.com",
  port: 10001,
  level: :error,
  type: "my_type_of_app_or_node",
  metadata: [
    extra_fields: "go here"
  ]

logger_logstash_backend's People

Contributors

marcelog avatar h00dy avatar deejay1 avatar kronicdeth avatar glennular avatar curiousleo avatar matteosister avatar pcewing avatar

Stargazers

Kamil Chmielewski avatar

Watchers

James Cloos avatar Kamil Chmielewski avatar Hubert Sajnaj avatar  avatar  avatar

Forkers

deejay1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.