Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

$ echo 'my-host my-process[1234]:@cee: {"hello":"world"}' | nc logsene-receiver-syslog.sematext.com 514

...

  • timestamp. Normally specified by your syslog daemon or the application logging to it. If it's not specified, like in the netcat example above, we'll set it to the time when it arrived to us
  • hostname. It's the my-host string in the netcat example above. Normally, the syslog daemon provides your host name automatically
  • severity. Normally specified by your syslog daemon. If it's not specified, like in the netcat example above, it will be notice
  • facility. Normally specified by your syslog daemon. If it's not specified, like in the netcat example above, it will be user
  • syslog-tag. It's the my-process[1234]: string in the netcat example above. Otherwise, the application provides it to the syslog daemon. For example, with logger, your tag will be "logger:"
  • source. It's the part of the syslog tag without the optional PID and the characters that surround it (my-process in the example above), and it's useful for filtering only logs from the same source

So the log above will appear similar to this (pretty-printed):

{
"@timestamp":"2012-12-03T11:42:54.644758+01:00",
"host":"my-host",
"severity":"notice",
"facility":"user",
"syslog-tag":"my-process:",
"source":"my-process:",
"hello": "world"
}

How do I specify a timestamp, severity and facility via netcat?

...

{
"@timestamp":"2012-12-03T11:42:54.644758+01:00",
"host":"my-host",
"severity":"notice",
"facility":"user",
"syslog-tag":"my-process:",
"source":"my-process",
"messsage": "{\"hello\":\"world\"}"
}