Technical Documentation

Changing the Alternative Facility Name for Remote System Log Messages

Some facilities assigned to messages logged on the local router or switch have the JUNOS Software–specific names (see JUNOS System Logging Facilities and Message Severity Levels). In the recommended configuration, a remote machine designated at the [edit system syslog host hostname] hierarchy level is not a Juniper Networks router or switch, so its syslogd utility cannot interpret the JUNOS Software–specific names. To enable the standard syslogd utility to handle messages from these facilities when messages are directed to a remote machine, a standard localX facility name is used instead of the JUNOS Software–specific facility name.

System Log Default Facilities for Messages Directed to a Remote Destination lists the default alternative facility name next to the JUNOS Software–specific facility name it is used for.

The syslogd utility on a remote machine handles all messages that belong to a facility in the same way, regardless of the source of the message (the Juniper Networks router or switch or the remote machine itself). For example, the following statements in the configuration of the router called local-router direct messages from the authorization facility to the remote machine monitor.mycompany.com:

[edit system syslog]host monitor.mycompany.com {authorization info;}

The default alternative facility for the local authorization facility is also authorization. If the syslogd utility on monitor is configured to write messages belonging to the authorization facility to the file /var/log/auth-attempts, the file contains both the messages generated when users log in to local-router and the messages generated when users log in to monitor. Although the name of the source machine appears in each system log message, the mixing of messages from multiple machines can make it more difficult to analyze the contents of the auth-attempts file.

To make it easier to separate the messages from each source, you can assign an alternative facility to all messages generated on local-router when they are directed to monitor. You can then configure the syslogd utility on monitor to write messages with the alternative facility to a different file from messages generated on monitor itself.

To change the facility used for all messages directed to a remote machine, include the facility-override statement at the [edit system syslog host hostname] hierarchy level:

[edit system syslog host hostname]facility severity;facility-override facility;

In general, it makes sense to specify an alternative facility that is not already in use on the remote machine, such as one of the localX facilities. On the remote machine, you must also configure the syslogd utility to handle the messages in the desired manner.

JUNOS System Log Alternate Facilities for Remote Logging lists the facilities that you can specify in the facility-override statement.

We do not recommend including the facility-override statement at the [edit system syslog host other-routing-engine] hierarchy level. It is not necessary to use alternative facility names when directing messages to the other Routing Engine, because its JUNOS system logging utility can interpret the JUNOS Software–specific names.

The following example shows how to log all messages generated on the local router at the error level or higher to the local0 facility on the remote machine called monitor.mycompany.com:

[edit system syslog]host monitor.mycompany.com {any error;facility-override local0;}

The following example shows how to configure routers located in California and routers located in New York to send messages to a single remote machine called central-logger.mycompany.com. The messages from California are assigned alternative facility local0 and the messages from New York are assigned to alternative facility local2.

  • Configure California routers to aggregate messages in the local0 facility:
    [edit system syslog]host central-logger.mycompany.com {change-log info;facility-override local0;}
  • Configure New York routers to aggregate messages in the local2 facility:
    [edit system syslog]host central-logger.mycompany.com {change-log info;facility-override local2;}

On central-logger, you can then configure the system logging utility to write messages from the local0 facility to the file california-config and the messages from the local2 facility to the file new-york-config.


Published: 2010-04-26