[an error occurred while processing this directive][an error occurred while processing this directive]

Examples: Configuring System Logging

Log messages about all commands entered by users at the CLI prompt or invoked by client applications such as JUNOScript or NETCONF clients, and all authentication or authorization attempts, both to the file cli-commands and to the terminal of any user who is logged in:

[edit system]
syslog {
	file cli-commands {
		interactive-commands info;
		authorization info;
	}
	user * {
		interactive-commands info;
		authorization info;
	}
}

Log all changes in the state of alarms to the file /var/log/alarms:

[edit system]
syslog {
	file alarms {
		kernel warning;
	}
}

Configure the handling of messages of various types, as described in the comments. Information is logged to two files, to the terminal of user alex, to a remote machine, and to the console:

[edit system]
syslog {
/* write all security-related messages to file /var/log/security */
	file security {
		authorization info;
		interactive-commands info;
	}
/* write messages about potential problems to file /var/log/messages: */
/* messages from “authorization” facility at level “notice” and above, */
/* messages from all other facilities at level “warning” and above */
	file messages {
		authorization notice;
		any warning;
	}
/* write all messages at level “critical” and above to terminal of user “alex” if */
/* that user is logged in */
	user alex {
		any critical;
	}
/* write all messages from the “daemon” facility at level “info” and above, and */
/* messages from all other facilities at level “warning” and above, to the */
/* machine monitor.mycompany.com */
	host monitor.mycompany.com {
		daemon info;
		any warning;
	}
/* write all messages at level “error” and above to the system console */
	console {
		any error;
	}
}

Configure the handling of messages generated when users issue JUNOS CLI commands, by specifying the interactive-commands facility at the following severity levels:

  • info—Logs a message when users issue any command at the CLI operational or configuration mode prompt. The example writes the messages to the file /var/log/user-actions.
  • notice—Logs a message when users issue the configuration mode commands rollback and commit. The example writes the messages to the terminal of user philip.
  • warning—Logs a message when users issue a command that restarts a software process. The example writes the messages to the console.
[edit system]
syslog {
	file user-actions {
		interactive-commands info;
	}
	user philip {
		interactive-commands notice;
	}
	console {
		interactive-commands warning;
	}
}

Published: 2010-04-28

[an error occurred while processing this directive]