Skip to content

Commit

Permalink
- No space between PRI and TIMESTAMP (RFCI3164)
Browse files Browse the repository at this point in the history
  • Loading branch information
jordansissel committed Nov 18, 2010
1 parent 8aea20c commit d4aa987
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/logstash/inputs/syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def register

# This comes from RFC3164, mostly.
@@syslog_re ||= \
/<([0-9]{1,3})> ([A-z]{3} [0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}) (\S+) (.*)/
/<([0-9]{1,3})>([A-z]{3} [0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}) (\S+) (.*)/
#<priority timestamp Mmm dd hh:mm:ss host msg
end # def register

Expand Down Expand Up @@ -72,7 +72,7 @@ def syslog_relay(event, url)

event.message = match[4]
else
@logger.info("NOT SYSLOG")
@logger.info(["NOT SYSLOG", event.message])
url.host = Socket.gethostname if url.host == "127.0.0.1"

# RFC3164 says unknown messages get pri=13
Expand All @@ -83,9 +83,9 @@ def syslog_relay(event, url)
event.fields["severity"] = 5 # 13 & 7 == 5
event.fields["facility"] = 1 # 13 >> 3 == 1

# TODO(sissel): ? Ignore RFC3164 and use ISO8601 timestamps (RFC5424?)
event.message = "<13> #{Time.now.strftime("%b %d %H:%M:%S")} " \
"#{url.host} #{event.message}"
# Don't need to modify the message, here.
# event.message = ...

event.source = url.to_s
end
end # def syslog_relay
Expand Down

0 comments on commit d4aa987

Please sign in to comment.