I want to have an output for Influx DB from Logstash, is there any such plugin available?
The output is set to graphite.. This is the influx config:
[input_plugins]
# Configure the graphite api
[input_plugins.graphite]
enabled = true
port = 2003
database = "AirAnalytics" # store graphite data in this database
# udp_enabled = true # enable udp interface on the same port as the tcp interface
This is the logstash config:
output {
stdout {}
graphite {
host => "localhost"
port => 2003
}
}
I see the output in the console (stdout) but no other message and nothing gets posted into influx. I checked the influx logs as well, nothing.
I tried posting the same message directly via http to influx and it works, so there's no issue with the message or influx install.
Solved it. I needed to pass on the already prepared influx compatible string to influx via logstash.
Following is the logstash configuration snippet which did the trick:
output {
http {
url => "http://localhost:8086/db/<influx db name>/series?u=<user name>&p=<pwd>"
format => "message"
content_type => "application/json"
http_method => "post"
message => "%{message}"
verify_ssl => false
}
stdout {}
}
Note: If you use the format "json" then logstash wraps the body around a "message" field which was causing a problem.
It's available via logstash-contrib as an output: https://github.com/elasticsearch/logstash-contrib/blob/master/lib/logstash/outputs/influxdb.rb
There is an influxdb output in logstash-contrib, however, this was added after 1.4.2 was released.
With logstash 1.5, there is a new plugin management system. If you're using 1.5, you can install the influxdb output with:
# assuming you're in the logstash directory
$ ./bin/plugin install logstash-output-influxdb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With