Logging
Logging is an important operational aspect. It is required for OPS to get informed about certain important events. At the same time, too much logging not only leads to overload of someone who looks at the logs, but it also stresses the system to create and process these logs.
It is strongly advised to use either error or critical log level in production
to avoid overloading the system.
System log levels
The log level indicates the severity of an event. According to the syslog protocol specified in RFC 5424Opens in a new tab, there are eight log levels:
Each log level is mapped to an integer value, and a log event passes the log level check if the integer value of its log level is less than or equal to the currently configured log level. That is, the check passes if the event is equally or more severe than the configured level.
Change the log level in a running erGW node
Follow these steps to change the log level in a running erGW node:
Search for the SMC pods in the cluster:
bashPick the SMC pod for which you want to adjust the log level:
bashWait a few seconds, access the diagnosis shell, and get the current system log level:
erlangGet the current configurations of the
defaultlogger handler:erlangSwitch to the other level:
- First, make the log handler accept the intended log level:
erlang- Set the log level for all modules:
erlang- Or set it for specific modules only:
erlangExit the diagnosis shell using ctrl+G, then q.
Add a special DEBUG log sink
You can redirect log messages from the default stdout to a file. This is most
useful to write debug logs to a temporary file while keeping the default stdout log
free of them to, for example, avoid overloading a log collector. To redirect log messages to a file:
Log into a node and access the diagnosis shell as before.
Check the current logging handler configuration:
erlangA node with a default logger setup by default has two handlers, one for events from Erlang TLS stack (
ssl_handler) and a default handler (default).Add a special debug handler:
erlangThis configuration uses the
logger_std_hhandler which appends log lines to the given file. You can also use thelogger_disk_log_hhandler which supports circular (wrapped) logs:erlangAdjust
max_no_filesandmax_no_bytesto your needs.