Logging
Itential Automation Gateway (IAG) provides the following logging tools to support your debugging efforts.
View Logs
To quickly view logs, set GATEWAY_LOG_LEVEL = DEBUG and run all iagctl commands with the --verbose flag.
Example
Logging in IAG
Console Logs
To display console logs to the terminal, append --verbose to the command you are running. For example, running iagctl get services --verbose launches the gateway with console logs.
File Logs
In most cases, the gateway log file is located at GATEWAY_APPLICATION_WORKING_DIR/gateway.log. This location is used when users run CLI commands to accommodate gateway CLI users that do not have /var/log access.
When gateway is launched as a server or runner, the log file is located at GATEWAY_LOG_SERVER_DIR/gateway.log.
If the GATEWAY_LOG_SERVER_DIR location is not specified, the system uses the default location /var/log/gateway/gateway.log.
Log Format
By default, logs are displayed in the following format:
You can display logs in JSON format by setting the environment variables GATEWAY_LOG_FILE_JSON=true or GATEWAY_LOG_CONSOLE_JSON=true. JSON format allows easier integration with third-party software such as log aggregation programs.
JSON logs resemble the following format:
By default, console logs have color formatting. To remove the color, set the environment variable GATEWAY_TERMINAL_NO_COLOR=true.
Log Levels
IAG supports different logging levels to denote the importance of a log as well as the severity of an error.
- Use the
GATEWAY_LOG_LEVELenvironment variable to set the log level - The default value of
GATEWAY_LOG_LEVELisINFO - Both file and console logs match the value set by
GATEWAY_LOG_LEVEL
Supported logging levels (ordered from least to most important) include:
- TRACE
- DEBUG
- INFO
- WARN
- ERROR
- FATAL
- DISABLED
IAG displays logs for the level set in GATEWAY_LOG_LEVEL as well as any logs of higher importance.
For example, if INFO logs are selected, a user will be shown logs for INFO, WARN, ERROR, and FATAL. They will not see DEBUG and TRACE logs.