Skip to content

Audian/ex_logdna

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI status badge

Elixir logger backend for LogDNA

A logger backend for elixir to send application logs to LogDNA through their ingestion API.

Installation

The package can be installed by adding ex_logdna to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_logdna, "~> 0.1.0"}
  ]
end

Configuration

First configure your logger to use the LogDNA backend. It also respects the level and metadata configuration.

config :logger, backends: [LogDNA], level: :info, metadata: [:request_id, :event, :tags]

Then configure the backend with some LogDNA specific configurations.

config :ex_logdna,
  ingestion_key: System.get_env("LOGDNA_INGESTION_KEY"),
  app: "my-app",
  hostname: "localhost",
  tags: ["web", "prod"]

Find more information in the LogDNA ingestion API documentation.

Usage

After configuring your application to use the LogDNA backend, just use logger as you normally would. To send a log entry with log level info for instance:

Logger.info("Logging stuff to LogDNA")

The backend has support for metadata, just pass it on as the second argument:

Logger.info("Logging stuff to LogDNA with additional metadata.", user_id: "some-user-id")

🪄 Magic metadata

Some metadata properties are reserved for magic.

Tags

If you pass in tags with your log entry, it won't be sent in as metadata, but as native LogDNA tags.

Logger.info("Logging stuff to LogDNA with additional metadata.", tags: ["one", "two"])

Should you have configured global tags in your config file, these event tags will be merged into the global tags, and they are all passed along to the ingestion API.

About

Logger backend for LogDNA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 100.0%