I have updated my fork at https://github.com/patrodyne/pound to version
2.8-patrodyne-20200113. The update adds LogFacility and LogLevel options to
improve journald logging and metric collection.
In addition to the existing LogFacility option '-' to direct log messages to
stdout and stderr, two new options have been added:
'+' same as '-' but prepend priority '<n>' to log messages.
'*' same as '+' but flush stdout after each log message.
The '+' option prepends '<3>' to stderr log messages and '*' prepends
'<6>' to
stdout log messages. When a systemd service unit is configured with
SyslogLevelPrefix=true (the default), then journalctl will consume the
priority
prefix and display error messages in color.
See https://www.freedesktop.org/software/systemd/man/sd-daemon.html#
See
https://www.freedesktop.org/software/systemd/man/systemd.exec.html#SyslogLevelPrefix=
A behavior of libc is the stream stderr is unbuffered; but, the stream
stdout is
line-buffered only when it points to a terminal. The stream stdout is fully
buffered when it is in non-terminal mode. When Pound is run as a
service, it is
in non-terminal mode and the stdout stream buffers the log messages
until the
buffer is full. The effect is that log lines are delayed in the buffer.
The '*' option flushes the stdout buffer after each log message. This
enables
line buffering when Pound is run as a service. Line buffering provides log
messages in a more real time manor for journalctl and for metric collection
tools like the Prometheus Grok Exporter.
LogLevel 6 is a new format for log messages with pipe delimited fields. As a
delimited record, it is more easily parsed by metric collectors like
like the
Prometheus Grok Exporter. The exact format is:
case 6:
logmsg(LOG_INFO, "%016lx|%s|%c%c%c|%0.3f|%s|%s|%s|%s|%s|%s|%s|%s|%s",
pthread_self(), // thread id
req_time, // request time ISO 8601
response[9], response[10], response[11], // response code
(end_req - start_req) / 1000000.0, // duration seconds
s_res_bytes[0] == '-' ? "0" : s_res_bytes, // response bytes
v_host[0] ? v_host : "", // target host:port
svc->name[0] ? svc->name : "", // service name
caddr, // source client address
buf, // backend address:port
u_name[0] ? u_name : "", // user name
u_agent, // user agent
referer, // refering URI
request); // request URL
break;
--
pound mailing list
[email protected]
https://admin.hostpoint.ch/mailman/listinfo/pound_apsis.ch