-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from bgentry/timestamp_opt
Use RFC5424 / RFC5426 syslog over UDP format
- Loading branch information
Showing
3 changed files
with
72 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
## Overview | ||
|
||
This library writes messages formatted as per [RFC5424][rfc5424], transmitted | ||
via UDP as described in [RFC5426][rfc5426]. | ||
|
||
### Enable UDP | ||
|
||
Ensure that syslogd has udp sockets enabled: | ||
[OS X](http://stackoverflow.com/questions/1185554/how-to-enable-syslogd-to-receive-udp-logs-from-routers-in-osx) | ||
You can configure syslog-ng to receive these messages with the following directive: | ||
|
||
syslog(transport("udp") port(514) keep_timestamp(yes)); | ||
|
||
### Build | ||
|
||
make | ||
|
||
### Log | ||
|
||
0> syslog:start_link(name, tag, "localhost", 514, local0). | ||
0> syslog:start_link(name, app_name, "localhost", 514, local0). | ||
ok | ||
2> syslog:send(name, "test"). | ||
ok | ||
3> syslog:notice(name, "other test"). | ||
ok | ||
4> syslog:send(name, "test 3", [{timestamp, os:timestamp()}]). | ||
ok | ||
|
||
### Logged | ||
|
||
$ syslog | ||
... | ||
Tue Mar 16 18:36:48 192.168.1.101 tag[4294967295] <Info>: test | ||
Tue Mar 16 18:36:57 192.168.1.101 tag[4294967295] <Notice>: other test | ||
<134>1 2013-04-03T21:30:44.403394Z myhost.local app_name pid - - my log message | ||
|
||
[rfc5424]: http://tools.ietf.org/html/rfc5424 "RFC5424 - The Syslog Protocol" | ||
[rfc5426]: http://tools.ietf.org/html/rfc5426#section-3.1 "RFC5426 - Transmission of Syslog Messages over UDP" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{application, syslog, [ | ||
{description, "Erlang syslog client"}, | ||
{vsn, "0.1"}, | ||
{vsn, "0.2"}, | ||
{applications, [kernel, stdlib]}, | ||
{registered, []} | ||
]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters