logstash-plugins / logstash-output-opentsdb

Apache License 2.0
5 stars 13 forks source link

Opentsdb is pushing metrics at Second resolution #1

Open harshamadala opened 8 years ago

harshamadala commented 8 years ago

Hi,

Is there any way to force opentsdb plugin to push metrics with millisecond resolution to opentsdb? I have logs which has millisecond resolution and @timestamp field reflects the same. But when I use opentsdb output plugin and push the same record, I see metric with second resolution in opentsdb.

CamJN commented 8 years ago

It's currently hard-coded as second resolution, I'm currently working on a rewrite based on the elasticsearch http api output plugin that supports milliseconds. You can track it at https://github.com/CamJN/logstash-output-opentsdb/tree/elasticsearch_inspired but if you just want a patch for millis and don't mind making your own fork, you want to replace https://github.com/logstash-plugins/logstash-output-opentsdb/blob/master/lib/logstash/outputs/opentsdb.rb#L69 with event.sprintf("%{+%s}%{+SSS}"),

harshamadala commented 8 years ago

Thanks a lot CamJN

buddyp450 commented 8 years ago

Sort of the same issue... this also causes OpenTSDB to not interpret human-readable timestamps into it's default or custom configured system time zone.

So in essence, by taking the human-readable time and converting it down to epoch inside of the plugin you're eliminating the handy feature of allowing multiple servers to communicate logs to OpenTSDB from different (system) time zones and having them all be the same time zone as the OpenTSDB system.

Ran into this unexpected consequence today. Why not just use the timestamp being passed in?

CamJN commented 8 years ago

In my case the timestamp being passed in is in unix epoch format.

TrumanDu commented 8 years ago

@harshamadala @buddyp450 can you give me a demo?how to use logstash and opentsdb