Syslog, RFC3164, ("foo:" ) TAG.
MSG , TAG CONTENT . TAG , .
Python..
import logging
from logging.handlers import SysLogHandler
h = SysLogHandler(address='/dev/log')
h.setFormatter(logging.Formatter('foo: %(message)s'))
logging.getLogger().addHandler(h)
logging.error('bar')
.. syslog-
connect(3, {sa_family=AF_UNIX, sun_path="/dev/log"}, 10) = 0
sendto(3, "<11>foo: bar\0", 13, 0, NULL, 0) = 13
close(3)
, , systemd.
Dec 13 14:48:20 laptop foo[1928]: bar
:
{
..
"PRIORITY" : "3",
"SYSLOG_FACILITY" : "1",
"SYSLOG_IDENTIFIER" : "foo",
"MESSAGE" : "bar",
"_PID" : "1928",
}
Py2.6, 2.7, 3.4, 3.5 Systemd syslog. syslog ( RFC3164). , , , python SysLogHandler RFC5424.