Configure System Logging
To configure the router to log system messages, include the
syslogstatement at the[edit system]hierarchy level:[edit system]syslog {archive {filesnumber;sizesize;(world-readable | no-world-readable);}filefilename{facility level;archive {filesnumber;sizesize;(world-readable | no-world-readable);}}hosthostname{facility level;facility-overridefacility;log-prefixstring;}user (username| *) {facility level;}console {facility level;}}The JUNOS system logging utility is similar to the UNIX
syslogdutility, and includes the following features:
- To a named file in a local file system, by including the
filestatement- To a remote machine that is running the
syslogdutility, by including thehoststatement- To the terminal session of one or more specific users (or all users) when they are logged into the router, by including the
userstatement- To the router console, by including the
consolestatement
- Each message is assigned to a facility, which is a group of messages that are either generated by the same software process or concern a similar condition or activity (such as authentication attempts). To log the messages belonging to one or more facilities to a particular destination, specify each facility name as a separate statement within the set of statements for the destination. Table 2 lists the JUNOS system logging facilities.
- Each message is assigned a severity level, which indicates how seriously it affects router functioning. When you configure logging for a facility and destination, you specify a severity level for each facility; messages that belong to the facility and are rated at that level or higher are logged to the destination. Table 3 lists the severity levels in order from highest to lowest.
- To prevent log files from growing too large, the JUNOS system logging utility by default writes messages to a sequence of files of a defined size. You can configure the number of files, their maximum size, and who can read them. For more information, see Configure Archiving of Log Files.
- When directing messages to a remote machine, you can configure features that make it easier to separate out JUNOS-specific messages or messages generated on particular routers. For more information, see Configure Handling of Messages Directed to a Remote Machine.
For a statement summary for the
syslogstatement, see the JUNOS Internet Software Configuration Guide: Getting Started.For information about special logging features and for examples, see the following sections: