How to Modify Custom Time Stamp

time
telegraf
#1

without Millisecond —> this config is success
-------------------------------------------- my log --------------------------------------------
2016/04/07 12:41:45,7
2016/04/07 12:41:46,8
2016/04/07 12:41:47,9
2016/04/07 12:41:48,10

-------------------------------------------- telegraf.conf --------------------------------------------
[inputs.logparser.grok]
custom_patterns = "TEST_TIMESTAMP %{YEAR}/%{MONTHDAY}/%{MONTHNUM} %{HOUR}:%{MINUTE}:%{SECOND}"
patterns = [’%{TEST_TIMESTAMP:timestamp:ts-“2002/01/06 15:04:05.412”},%{NUMBER:value:int}’]

add Millisecond —> this config is Fail
-------------------------------------------- my log --------------------------------------------
2016/04/07 12:41:45.123,7
2016/04/07 12:41:46.435,8
2016/04/07 12:41:47.645,9
2016/04/07 12:41:48.645,10

-------------------------------------------- telegraf.conf --------------------------------------------
[inputs.logparser.grok]
custom_patterns = "TEST_TIMESTAMP %{YEAR}/%{MONTHDAY}/%{MONTHNUM} %{HOUR}:%{MINUTE}:%{SECOND}.\d+}"
patterns = [’%{TEST_TIMESTAMP:timestamp:ts-“2002/01/06 15:04:05.412”},%{NUMBER:value:int}’]

I want to parse the my custom Log ( add millisecond )
but i don’t know how to modify custom time stamp, when add millisecond

Thanks

#2

The library we are using doesn’t support timestamps using comma as the separator, but if you can switch to using a . and leading zeroes for the milliseconds you should be able to get it working. We have a ticket open that you can follow for updates: https://github.com/influxdata/telegraf/issues/3571