Logging
Logging
To provide context to each log message, structured logging is used. By dividing the log data into fields of name-value pairs, the logs become more coherent and are better suited for processing by external tools.
Log messages related to a specific channel include a log field named
chName (channel name), which can be used to filter messages for specific channels.
Log formats
From the command line, by specifying -logformat parameters, ew-cmaf-ingest
supports the following logging formats: consolepretty, consolejson, or journald.
To disable logging, set it to discard. The default logging format is consolejson.
Format setup example:
$ ./ew-cmaf-ingest -logformat consolejson
consoleprettylogs to standard output (stdout) in a human-readable format. Each log line starts with the date and the log message, followed by context-dependent log fields:2025-01-03T15:17:58+07:00 INF Wrote segment chName=testpic_2s name=867946138.cmfv nrBytes=37863 trName=V300
consolejsonlogs tostdoutusing a JSON object for each message:{“level”:“info”,“chName”:“testpic_2s”,“trName”:“A48”,“seqNr”:867946183,“oldestNr”:867946176,“latestNr”:867946183, …}
When switching the
-logformattojournald,ew-cmaf-ingestwill send logs tojournaldfollowing thejournaldformat, with field names in uppercase. Examples:To see entries with the channel name
testpic_2s:$ journalctl -u ew-cmaf-ingest CHNAME=testpic_2s -o verboseTo see entries with the stream name
A48:$ journalctl -u ew-cmaf-ingest NAME=A48 -o verbose
Using the verbose output includes all available name-value fields. Without
this option, only the log message is printed. The field named JSON contains the
original structured log message as sent by the service. To filter out only thisfield,
use --output-fields=JSON. Note that this requires a systemd version of at least 236.
$ journalctl -u ew-cmaf-ingest --output-fields=JSON CHNAME=testpic_2s
To continuously monitor the service:
$ journalctl -fu ew-cmaf-ingest
Log levels
At startup, default value is info.
The log level can be changed by posting a form field named level to the
loglevel endpoint on the ew-cmaf-ingest server:
sh $ curl -F level=debug <ew-cmaf-ingest-server>:<server-port>/loglevel
The available log levels and their corresponding systemd priority values
are listed below:
Log level Systemd priority
trace 7
debug 7
info 6
warn 4
error 3
fatal 2
panic 0
To see all error and warning messages using journalctl, run:
$ journalctl -u ew-cmaf-ingest PRIORITY=3 PRIORITY=4
To see the current log level, use a GET request:
$ curl <ew-cmaf-ingest-server>:<server-port>/loglevel
Messages with a higher level than the configured one will not be logged.