Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logstash - is an output to influx DB available?

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.

like image 557
Sumit Maingi Avatar asked Sep 19 '14 11:09

Sumit Maingi


3 Answers

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.

like image 90
Sumit Maingi Avatar answered Nov 10 '22 12:11

Sumit Maingi


It's available via logstash-contrib as an output: https://github.com/elasticsearch/logstash-contrib/blob/master/lib/logstash/outputs/influxdb.rb

like image 41
Paul Dix Avatar answered Nov 10 '22 10:11

Paul Dix


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
like image 1
Wilfred Hughes Avatar answered Nov 10 '22 10:11

Wilfred Hughes