7.7 Configuring Nagios Logging

By default, Nagios logs events for the host and services in the /var/log/nagios/nagios.log file. Use the /etc/nagios/nagios.cfg file to control logging for Nagios. For information about logging options, see Table 7-3.

Table 7-3 Nagios Logging Options

Logging Parameter

Description and Logging Options

Default Setting

log_file

Specifies the path of the log file, including the file name.

/var/log/nagios/nagios.log

log_rotation_method

Specifies the rotation method that Nagios should use to rotate its main log file, or disables rotation of the log.

  • n: None, don’t rotate the log

  • h: Hourly rotation (at the top of the hour, every hour)

  • d: Daily rotation (at midnight, every day)

  • w: Weekly rotation (at midnight on Saturday evening)

  • m: Monthly rotation (at midnight on the evening of the last day of the month)

Rotate the nagios.log file at midnight every day.

log_archive_path

Specifies the path of the directory where rotated (archived) log files are stored, if log rotation is enabled.

/var/log/nagios/archives

use_syslog

Specifies whether to log Nagios messages to the syslog facility as well as to the Nagios main log file.

  • 1: Enable messages to syslog.

  • 0: Disable messages to syslog.

Messages are sent to syslog as well as to nagios.log.

log_notifications

Specifies whether to log notifications.

  • 1: Log notifications.

  • 0: Do not log notifications.

Log notifications.

log_service_retries

Specifies whether to log service check retries.

  • 1: Log service check retries.

  • 0: Do not log service check retries.

Log service retries.

log_host_retries

Specifies whether to log host check retries.

  • 1: Log host check retries.

  • 0: Do not log host check retries.

Log host check retries.

log_event_handlers

Specifies whether to log host and service event handlers.

  • 1: Log host and service event handlers.

  • 0: Do not log host and service event handlers.

Log host and service event handlers.

log_initial_states

Specifies whether to log the initial state for every host and service the first time its status is checked. Enable this option only if you are using an external application that reports its long-term state statistics.

  • 1: Log the initial state for every host and service.

  • 0: Do not log the initial state for every host and service.

Do not log the initial state for every host and service.

log_external_commands

Specifies whether to log external commands.

  • 1: Log external commands.

  • 0: Do not log external commands.

NOTE:The check_external_commands option is enabled by default for OES Remote Manager. This enables you to use the CGI command interface.

The command_check_interval is set to -1 by default for OES Remote Manager. This causes Nagios to check the external command file as often as possible.

Log external commands.

log_passive_checks

Specifies whether to log passive host and service checks.

  • 1: Log passive checks.

  • 0: Do not log passive checks.

Log passive checks.