Skip to content

Latest commit

 

History

History
84 lines (49 loc) · 2.36 KB

README.md

File metadata and controls

84 lines (49 loc) · 2.36 KB

img https://cljdoc.org/badge/net.clojars.rrudakov/timbre-syslog-remote

Third-party timbre syslog appender with remote host support.

The main purpose of this library is to provide a direct integration of timbre and Papertrail.

The format of messages is compliant with RFC 3164.

Status

The library is tested with papertrail and I don't expect any breaking changes. It's not tested with localhost, but it should work if syslog is configured properly (it should listen to the port 514).

Usage

deps.edn

net.clojars.rrudakov/timbre-syslog-remote {:mvn/version "0.2.8"}

Leiningen

[net.clojars.rrudakov/timbre-syslog-remote "0.2.8"]

Register appender

(require '[io.rrudakov.timbre.syslog :refer [syslog-appender]])

(binding [timbre/*config*
          (assoc-in timbre/*config* [:appenders :syslog]
                    (syslog-appender {:host           "logs2.papertrailapp.com"
                                      :port           99999
                                      :no-stacktrace? true
                                      :ident          "application.name"}))]

  (timbre/infof "This is my info %d" (rand-int 999)))

Configuration

All configuration parameters are optional.

  • :host: remote host to connect (default: localhost)
  • :port: UDP port (default: 514)
  • :ident: application name (default: nil)
  • :no-stacktrace?: if false stacktraces will be logged (default: false)

stacktraces

Syslog doesn't support multiline log messages by default, but sometimes it's useful to print exceptions with stacktraces. If option :no-stacktrace? is false, stacktrace will be sent line by line:

img