Configure logging by going to System Console > Environment > Logging, or by editing the config.json file as described in the following tables. Changes to configuration settings in this section require a server restart before taking effect.

Output logs to console

Available in legacy Enterprise Edition E10/E20

Configure Mattermost to output logs to the console.

  • true: (Default) Output log messages are written to the console based on the console log level configuration. The server writes messages to the standard output stream (stdout).

  • false: Output log messages aren’t written to the console.

  • System Config path: Environment > Logging

  • config.json setting: ".LogSettings.EnableConsole": true",

  • Environment variable: MM_LOGSETTINGS_ENABLECONSOLE

Console log level

Available in legacy Enterprise Edition E10/E20

The level of detail in log events written when Mattermost outputs log messages to the console.

  • DEBUG: (Default) Outputs verbose detail for developers debugging issues.

  • ERROR: Outputs only error messages.

  • INFO: Outputs error messages and information around startup and initialization.

  • System Config path: Environment > Logging

  • config.json setting: ".LogSettings.ConsoleLevel": DEBUG",

  • Environment variable: MM_LOGSETTINGS_CONSOLELEVEL

Output console logs as JSON

Available in legacy Enterprise Edition E10/E20

Configure Mattermost to output console logs as JSON.

  • true: (Default) Logged events are written in a machine-readable JSON format.

  • false: Logged events are written in plain text.

  • System Config path: Environment > Logging

  • config.json setting: ".LogSettings.ConsoleJson": true",

  • Environment variable: MM_LOGSETTINGS_CONSOLEJSON

Note: Typically set to true in a production environment.

Output logs to file

Available in legacy Enterprise Edition E10/E20

Configure Mattermost to output console logs to a file.

  • true: (Default) Logged events are written based on the file log level configuration to a mattermost.log file located in the directory configured via file location.

  • false: Logged events aren’t written to a file.

  • System Config path: Environment > Logging

  • config.json setting: ".LogSettings.EnableFile": true",

  • Environment variable: MM_LOGSETTINGS_ENABLEFILE

Note: Typically set to true in a production environment.

File log level

Available in legacy Enterprise Edition E10/E20

The level of detail in log events when Mattermost outputs log messages to a file.

  • DEBUG: Outputs verbose detail for developers debugging issues.

  • ERROR: Outputs only error messages.

  • INFO: (Default) Outputs error messages and information around startup and initialization.

  • System Config path: Environment > Logging

  • config.json setting: ".LogSettings.FileLevel": INFO",

  • Environment variable: MM_LOGSETTINGS_FILELEVEL

Output file logs as JSON

Available in legacy Enterprise Edition E10/E20

Configure Mattermost to output file logs as JSON.

  • true: (Default) Logged events are written in a machine-readable JSON format.

  • false: Logged events are written in plain text.

  • System Config path: Environment > Logging

  • config.json setting: ".LogSettings.FileJson": true",

  • Environment variable: MM_LOGSETTINGS_FILEJSON

Note: Typically set to true in a production environment.

File log directory

Available in legacy Enterprise Edition E10/E20

The location of the log files.

String input. If left blank, log files are stored in the ./logs directory.

  • System Config path: Environment > Logging

  • config.json setting: ".LogSettings.FileLocation": "",

  • Environment variable: MM_LOGSETTINGS_FILELOCATION

Note: The path you configure must exist, and Mattermost must have write permissions for this directory.

Enable webhook debugging

Available in legacy Enterprise Edition E10/E20

Configure Mattermost to capture the contents of incoming webhooks to log files for debugging.

  • true: (Default) The contents of incoming webhooks are printed to log files for debugging.

  • false: The contents of incoming webhooks aren’t printed to log files.

  • System Config path: Environment > Logging

  • config.json setting: ".LogSettings.EnableWebhookDebugging": true",

  • Environment variable: MM_LOGSETTINGS_ENABLEWEBHOOKDEBUGGING

Enable diagnostics and error reporting

Available in legacy Enterprise Edition E10/E20

Whether or not diagnostics and error reports are sent to Mattermost, Inc.

  • true: (Default) Send diagnostics and error reports.

  • false: Diagnostics and error reports aren’t sent.

  • System Config path: Environment > Logging

  • config.json setting: ".LogSettings.EnableDiagnostics": "",

  • Environment variable: MM_LOGSETTINGS_ENABLEDIAGNOSTICS

Note: See the telemetry docummentation for details on the information Mattermost collects.

Output logs to multiple targets

Available in legacy Enterprise Edition E10/E20

Configure Mattermost to allow any combination of console, local file, syslog, and TCP socket targets, and send log records to multiple targets.

String input can contain a filespec to another configuration file, a database DSN, or JSON.

  • System Config path: Environment > Logging

  • config.json setting: ".LogSettings.AdvancedLoggingJSON":: "",

  • Environment variable: MM_LOGSETTINGS_ADVANCEDLOGGINGJSON

Notes:

  • These targets have been chosen as they support the vast majority of log aggregators, and other log analysis tools, without needing additional software installed.

  • Logs are recorded asynchronously to reduce latency to the caller.

  • Advanced logging supports hot-reloading of logger configuration.

Note: See the audit log v2 documentation for additional information.

Colorize plain text console logs

Enables system admins to display plain text log level details in color.

  • true: When logged events are output to the console as plain text, colorize log levels details.

  • false: (Default) Plain text log details aren’t colorized in the console.

  • System Config path: N/A

  • config.json setting: ".LogSettings.ENABLECOLOR": false",

  • Environment variable: MM_LOGSETTINGS_ENABLECOLOR

Maximum field size

Enables system admins to limit the size of log fields during logging.

Numerical value. Default is 2048.

  • System Config path: N/A

  • config.json setting: ".LogSettings.MaxFieldSize": 2048",

  • Environment variable: MM_LOGSETTINGS_MAXFIELDSIZE