Objective
In some instances, it may be necessary to collect agent logs and provide them to Contrast Support for troubleshooting purposes.
Process
Our documentation provides details on the various Log Levels . Depending on the issue, logging at DEBUG
or TRACE
level may be required to help diagnose the problem. Contrast Support can advise further if you are unsure which level of logging is required for your issue.
The following are KBs relating to the Contrast agents and the Agent Operator. They provide further details on how to configure logging levels and where to direct the logging output to. You should choose the best approach depending on the set up / environment your application runs within:
- How to get logs from the Java agent
- How to get logs from the .NET Core agent
- How to get logs from the .NET Framework agent
- How to get logs from the Node agent
- How to get logs from the Python agent
- How to get logs from the Ruby agent
- How to get logs from the PHP agent
- How to get logs from the Go agent
- How to get logs from the Agent Operator
Logging Configuration Properties
The following describes the logging configuration properties. Environment variables are used by way of example. The configuration can also be supplied via YAML or for the Java agent -D
arguments.
Please consult our documentation for information on the configuration Order of precedence .
Some properties may not be supported across all agents. The easiest way to determine the supported properties for a particular agent is use the Agent Configuration Editor . Select an option from the "Validate using the" list for agent-specific YAML validation.
CONTRAST__AGENT__LOGGER__PATH=./contrast_agent.log
Enable diagnostic logging by setting a path to a log file. While diagnostic logging hurts performance, it generates useful information for debugging Contrast. The value set here is the location to which the agent saves log output. If no log file exists at this location, the agent creates a file. Example - /opt/Contrast/contrast.log
creates a log in the /opt/Contrast
directory, and rotates it automatically as needed.
CONTRAST__AGENT__LOGGER__LEVEL=INFO
Set the the log output level. Valid options are ERROR
, WARN
, INFO
, DEBUG
, and TRACE
.
CONTRAST__AGENT__LOGGER__STDOUT=false
Set to true
to redirect all logs to stdout
instead of the file system.
CONTRAST__AGENT__LOGGER__STDERR=false
Set to true
to redirect all logs to stderr
instead of the file system. May be combined with the corresponding stdout
configuration to write to both streams.
CONTRAST__AGENT__LOGGER__ROLL_DAILY=false
Change the Contrast logger from a file-sized based rolling scheme to a date-based rolling scheme. At midnight server time, the previous day log is renamed to file_name.yyyy-MM-dd. Note - this scheme does not have a size limit; manual log pruning is required. You must set this flag to use the backups and size flags.
CONTRAST__AGENT__LOGGER__ROLL_SIZE=100
Set the roll size for log files in megabytes. The agent will attempt to prevent the log file from being larger than this size.
CONTRAST__AGENT__LOGGER__BACKUPS=10
Set the number of backup files to keep. Set to 0
to disable.