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.

Tip

You can manage additional logging configuration within the config.json file specifically for Mattermost notifications under NotificationLogSettings. These settings are equivalent to the configuration settings available under LogSettings.

Output logs to console#

Also available in legacy Mattermost Enterprise Edition E10 or 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#

Also available in legacy Mattermost Enterprise Edition E10 or 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#

Also available in legacy Mattermost Enterprise Edition E10 or 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.

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

Output logs to file#

Also available in legacy Mattermost Enterprise Edition E10 or 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 directory#

Also available in legacy Mattermost Enterprise Edition E10 or 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.

File log level#

Also available in legacy Mattermost Enterprise Edition E10 or 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#

Also available in legacy Mattermost Enterprise Edition E10 or 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.

Enable webhook debugging#

Also available in legacy Mattermost Enterprise Edition E10 or E20

Configure Mattermost to capture the contents of incoming webhooks to console and/or file logs 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

Note: Enable debug logs by changing the file log level to DEBUG to include the request body of incoming webhooks in logs.

Output logs to multiple targets#

Also available in legacy Mattermost Enterprise Edition E10 or 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 Mattermost logging documentation for details.

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

Enable diagnostics and error reporting#

Also available in legacy Mattermost Enterprise Edition E10 or 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.