Streambuilder logging¶
Common information¶
The Streambuilder service logging is configured in the logger section of the configuration.
logger { level { default 2 } readable_time yes listen "unix:/var/run/streambuilder/Channel.s" filename "/var/log/streambuilder/Channel/streambuilder.log" }
Logging information is written in the form
[2021-04-23 11:48:13.044] [23394] [logReactor] [INFO] main reactor created
[2021-04-23 11:48:13.044] [23394] [streambuilder] [INFO] version: R21.4/8f44271...
Information in each line of the log file is displayed in the following format:
at the beginning of each line the output time of the log entry;
identifier of running Streambuilder process (pid);
Streambuilder module - the source of message;
the log level set for this entry;
log information.
The information for packets passing modules has a more advanced form:
[2021-04-23 13:20:08.818] [6054] [hlswriter] [INFO] {FileHlsSaver} saved:"/var/streambuilder/CMoreStarsN/480p/1619/17/32/1619173208296.ts" [0.288904ms]
[2021-04-23 13:20:12.858] [6054] [hlswriter] [INFO] {FileHlsSaver} saved:"/var/streambuilder/CMoreStarsN/480p/1619/17/32/1619173212296.ts" [0.333801ms]
[2021-04-23 13:20:16.768] [6054] [hlswriter] [INFO] {FileHlsSaver} saved:"/var/streambuilder/CMoreStarsN/480p/1619/17/32/1619173216296.ts" [0.34744ms]
The name of a specific module in Streambuilder configuration is added in curly braces.
Streambuilder provides following levels for output information:
[0] ERROR;
[1] WARNING;
[2] INFO;
[3] NOTICE;
[4] VERBOSE;
[5] DEBUG;
The lower the value of the log recording level, the more meaningful information is displayed. Records with a log level of ERROR are critical errors and after their output to the log file, the Streambuilder service is always restarted.
Configuration options¶
Level section¶
The level section is used to specify the default logging level for a particular service and initially equals to 2 (INFO). If there is no more information in this section, then for all Streambuilder modules used in the service configuration, the log levels are set to this value.
In addition to specifying the default value for the log level, it is possible to change this level for each individual module, for example
level {
default 2
orderpacket 4
fillgap 3
hlswriter 4
avvdecoder 4
}
readable_time option¶
If the readable_time option is not specified in the configuration or its value is “no”, then the log will be output in the format using unix timestamp.
[1619167617] [23107] [logReactor] [INFO] main reactor created
[1619167617] [23107] [streambuilder] [INFO] version: R21.4/8f44271...
If the readable_time value “yes” is specified, the log is output in the format using the usual date/time format with milliseconds
[2021-04-23 11:48:13.044] [23394] [logReactor] [INFO] main reactor created
[2021-04-23 11:48:13.044] [23394] [streambuilder] [INFO] version: R21.4/8f44271...
listen option¶
Used to specify a socket through which you can control the log levels of both individual modules and the common default log level. Valid values are tcp- or unix-sockets.
tcp-socket
listen "tcp:127.0.0.1:45025"
listen "127.0.0.1:45025"
unix-socket
listen "unix:/var/run/streambuilder/Channel.s"
listen "/var/run/streambuilder/Channel.s"
filename option¶
Used to specify the file name to which the Streambuilder service execution time information will be written.
Managing module log levels¶
Getting a list of module log levels¶
To get a list of log levels, send the getall command to Streambuilder logger.
tcp-socket
$ echo getall |socat - tcp:127.0.0.1:45025
aacwriter 2
amf 2
...
OK
unix-socket
# echo getall |socat - unix:/var/run/streambuilder/Channel.s
aacwriter 2
amf 2
...
OK
Getting the log level of a separate module¶
To get a separate module log level, send the get <loggername> command to Streambuilder logger
tcp-socket
$ echo "get hlswriter" |socat - tcp:127.0.0.1:45025
hlswriter 2
OK
unix-socket
# echo "get hlswriter" |socat - unix:/var/run/streambuilder/CMoreStarsN.s
hlswriter 2
OK
Setting the log level of a separate module¶
The logging levels of individual modules can be changed while the service is running without restarting. To set/change the log level of a separate module, send the set <loggername> <loglevel> command to the Streambuilder logger. The <loglevel> value must be numeric from 0 to 5.
tcp-socket
$ echo "set hlswriter 3" |socat - "tcp:127.0.0.1:45025"
OK
$ echo "get hlswriter" |socat - "tcp:127.0.0.1:45025"
hlswriter 3
OK
unix-socket
# echo "set hlswriter 3" |socat - unix:/var/run/streambuilder/CMoreStarsN.s
OK
# echo "get hlswriter" |socat - unix:/var/run/streambuilder/CMoreStarsN.s
hlswriter 3
OK
Log rotation¶
For every Streambuilder service, a configuration file must be created in the /etc/logrotate.d directory to rotate the logs.
tcp-socket
/var/log/streambuilder/Channel/streambuilder.log {
missingok
copytruncate
delaycompress
compress
daily
rotate 7
notifempty
sharedscripts
postrotate
echo reopen /var/log/streambuilder/Channel/streambuilder.log | socat - tcp:127.0.0.1:45025
sleep 3
endscript
}
unix-socket
/var/log/streambuilder/Channel/streambuilder.log {
missingok
copytruncate
delaycompress
compress
daily
rotate 7
notifempty
sharedscripts
postrotate
echo reopen /var/log/streambuilder/Channel/streambuilder.log | socat - /var/run/streambuilder/Channel.s
sleep 3
endscript
}
To reopen the log file descriptor on the Streambuilder side the reopen /var/log/streambuilder/Channel/streambuilder.log command is executed.