GithubHelp home page GithubHelp logo

darkua / logger_humio_backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sghiaa/logger_splunk_backend

0.0 1.0 0.0 96 KB

Humio backend for the Elixir Logger

License: MIT License

Elixir 100.00%

logger_humio_backend's Introduction

LoggerHumioBackend

About

A backend for the Elixir Logger that will send logs to Humio.

Supported options

Required

  • host: String.t. The hostname of the Humio ingest API endpoint.
  • token: String.t. The unique Humio ingest token for the log destination.

Optional

  • format: String.t. The logging format of the message. [default: [$level] $message\n].
  • level: atom. Minimum level for this backend. [default: :debug]
  • metadata: Keyword.t. Extra fields to be added when sending the logs. These will be merged with the metadata sent in every log message. [default: []]
  • client: Logger.Humio.Backend.Client. Client used to send messages to Humio. [default: Logger.Humio.Backend.Client.Tesla]
  • ingest_api: Logger.Humio.Backend.IngestApi. Humio API endpoint to which to send the logs. [default: Logger.Humio.Backend.IngestApi.Unstructured]
  • max_batch_size: pos_integer. Maximum number of logs that the library will batch before sending them to Humio. [default: 20]
  • flush_interval_ms: pos_integer. Maximum number of milliseconds that ellapses between flushes to Humio. [default: 10_000]

Using it with Mix

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

def deps do
  [{:logger_humio_backend, git: "https://github.com/akasprzok/logger_humio_backend/", tag: "v0.0.5"}]
end

Then run mix deps.get to install it.

Configuration Examples

Runtime

Logger.add_backend {Logger.Backend.Humio, :debug}
Logger.configure {Logger.Backend.Humio, :debug},
  format: "[$level] $message\n"
  host: "https://humio-ingest.bigcorp.com:443",
  level: :debug,
  token: "ingest-token-goes-here",

Application config

Minimal

config :logger,
  backends: [{Logger.Backend.Humio, :humio_log}, :console]

config :logger, :humio_log,
  host: "https://humio-ingest.bigcorp.com:443/",
  token: "ingest-token-goes-here",

With All Options

config :logger,
  backends: [{Logger.Backend.Humio, :humio_log}, :console]

config :logger, :humio_log,
  host: "https://humio-ingest.bigcorp.com:443/",
  token: "ingest-token-goes-here",
  format: "[$level] $message\n",
  level: :debug,
  metadata: [:request_id, :customer_id],
  client: Logger.Backend.Humio.Client.Tesla,
  ingest_api: Logger.Backend.Humio.IngestApi.Unstructured,
  max_batch_size: 50,
  flush_interval_ms: 5_000

Batching

The library will batch requests until either

  1. the buffer of logs has reached the max_batch_size or
  2. an amount of time equal to flush_interval_ms has passed.

At this point the logger backend will send all accrued log events to Humio, and reset the flush interval timer.

The logger can be flushed manually by calling Logger.flush(). Note this will flush all registered logger backends.

logger_humio_backend's People

Contributors

akasprzok avatar cblage avatar paulswartz avatar sghiaa avatar thestonefox avatar

Watchers

 avatar

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.