You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We would like to keep the original log timestamp in place of the syslog message timestamp when sending the syslog message to the destination. However, it seems that the original log timestamp is overwritten by Time.now = the time when the packet is sent.
We're using TCP and syslog RFC 3164
This is and extract of our td-agent configuration:
Mar 24 11:48:40 myhostname sshd[25533]: reprocess config line 126(...)
We have captured the network packet produced by the plugin: we can see that the syslog timestamp is equal to the time of packet sending (11:49:47 truncated at the second) instead of the original log timestamp (11:48:40)
What we see:
hidden is
either hostname that produced the log ("host: myhostname" in the message)
or the log aggregator hostname (displayed in "syslog hostname")
USER.DEBUG is PRI (or <1 5>)
syslog timestamp (format is RFC 3164 ) : it is the date of packet sending.
We would like to have the original log timestamp here, as parsed by the td-agent configuration "time" variable.
I believe that https://github.com/eric/syslog_protocol supports it: here it is getting the timestamp from the message and putting Time.now only if time is not found or PRI in incorrect:
if pri and (pri = pri.to_i).is_a? Integer and (0..191).include?(pri)
packet.pri = pri
else
# If there isn't a valid PRI, treat the entire message as content
packet.pri = 13
packet.time = Time.now
packet.hostname = origin || 'unknown'
packet.content = original_msg
return packet
end
time = parse_time(msg)
if time
packet.time = Time.parse(time)
else
packet.time = Time.now
end
Thanks!
The text was updated successfully, but these errors were encountered:
Hello,
We're using fluentd td-agent to get logs from linux servers (/var/log/secure) and send them to a remote destination using https://github.com/reproio/remote_syslog_sender and https://github.com/eric/syslog_protocol
We would like to keep the original log timestamp in place of the syslog message timestamp when sending the syslog message to the destination. However, it seems that the original log timestamp is overwritten by Time.now = the time when the packet is sent.
We're using TCP and syslog RFC 3164
This is and extract of our td-agent configuration:
Example log file:
We have captured the network packet produced by the plugin: we can see that the syslog timestamp is equal to the time of packet sending (11:49:47 truncated at the second) instead of the original log timestamp (11:48:40)
What we see:
We would like to have the original log timestamp here, as parsed by the td-agent configuration "time" variable.
I believe that https://github.com/eric/syslog_protocol supports it: here it is getting the timestamp from the message and putting Time.now only if time is not found or PRI in incorrect:
https://github.com/eric/syslog_protocol/blob/master/lib/syslog_protocol/parser.rb#L9
Thanks!
The text was updated successfully, but these errors were encountered: