Liking cljdoc? Tell your friends :D


Clojars Project A LogStash appender for timbre.

This will send json through a socket to your logstash listener.

##Dependencies ###Leiningen [com.flybe/socket-rocket "0.1.0"] ###Gradle compile "com.flybe:socket-rocket:0.1.0" ###Maven



Timbre Configuration:

(require '[socket-rocket.logstash :refer (logstash-appender make-logstash-appender)])

(timbre/set-config! [:appenders :logstash] logstash-appender)
(timbre/set-config! [:shared-appender-config :logstash] {:port 4660 :logstash ""})

LogStash Server configuration:

input {
	tcp {
	data_timeout => 5
	host => ""
	port => 4660
	mode => "server"
	type => "clojure"

filter {
	if [type] == "clojure" {
		json {
			source => "message"

output { 
    elasticsearch { 
        host => localhost 


You can specify a custom formatter for transforming timbre log events into messages to logstash. Default formatter used by the logstash-appender looks like this:

(defn json-formatter
  [{:keys [level throwable timestamp message hostname args] :as params}]
    {:level      level
     :throwable  (timbre/stacktrace throwable)
     :msg        message
     :timestamp  (-> timestamp strs/upper-case)
     :hostname   (-> hostname strs/upper-case)
     :ns         (str *ns*)}))

But you can specify your own function, my-json-formatter and override the default appender in the config like so:

(timbre/set-config! [:appenders :logstash] (make-logstash-appender my-json-formatter))


Copyright © 2014 Flybe

Distributed under the Eclipse Public License v1.0.

Can you improve this documentation? These fine people already did:
Jamie Bowdidge & Vadim Platonov
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close