aphyr/riemann — pull request #266 by tjake (2013-09-24 20:53:14+00:00)
Title: Add logstash client based on existing graphite client

Adds a logstash compatible client to riemann

example riemann config:

````
; -*- mode: clojure; -*-
; vim: filetype=clojure

(logging/init :file "riemann.log")

; Listen on the local interface over TCP (5555), UDP (5555), and websockets
; (5556)
(let [host "127.0.0.1"]
(tcp-server :host host)
(udp-server :host host)
(ws-server :host host))

(def stash (logstash {:host "localhost" :port 9999 :protocol :udp}))

; Expire old events from the index every 5 seconds.
(periodically-expire 5)

; Keep events in the index for 5 minutes by default.
(let [index (default :ttl 300 (update-index (index)))]

; Inbound events will be passed to these streams:
(streams

; Index all events immediately.
index

; Stash all the things
stash

; Calculate an overall rate of events.
(with {:metric 1 :host nil :state "ok" :service "events/sec"}
(rate 5 index))

; Log expired events.
;(expired
(fn [event] (info "debug" event))
))
````

Example logstash config:

`````
input {
file{
path => "/dev/null"
}

tcp {
port => 9999
codec => "json"
}

udp {
port => 9999
codec => "json"
}
}

output {
stdout {
# Enabling 'debug' on the stdout output will make logstash pretty-print the
# entire event as something similar to a JSON representation.
debug => true
}

# You can have multiple outputs. All events generally to all outputs.
# Output events to elasticsearch
elasticsearch {
embedded => true
}
}
````