Junos logging
Rules for where logs go and how useful they are. Logs that stay on the device can be lost or deleted, and logs without exact times are hard to match up. They come from the junos-logging policy template.
Every example on this page was checked with rConfig Pro's policy engine on Each of the 10 configs below was run through rConfig Pro’s evaluator with the rule above it, and gave the result shown. The configs are sanitised excerpts of the sample configs that come with the template.
All the rules come from junos-logging.policy in the policy templates (v1.5.0). Import the whole file with Import Templates (see importing a policy template), or copy one rule into your own definition. The Juniper Junos templates page lists the file’s known limitations. Run the rules against show configuration | display set.
| Rule | Method | Since |
|---|---|---|
| Remote syslog for all messages | must_match_regex |
8.0.0 |
| Remote syslog for login messages | must_match_regex |
8.0.0 |
| Millisecond timestamps | must_match_regex |
8.0.0 |
| No console logging | must_not_match_regex |
8.0.2 |
| Time zone is UTC | must_not_match_regex |
8.0.2 |
Remote syslog for all messages
A copy of the logs off the device survives a reboot, and an attacker on the device cannot delete it. This rule needs a set system syslog host line that sends any facility at info or notice.
// A remote syslog host receives any facility at info or notice (set system syslog host ... any info or any notice)#[must_match_regex]/^set system syslog host \S+ any (info|notice)$/mset system syslog host 192.0.2.50 any noticeset system syslog host 192.0.2.50 authorization infoset system syslog file messages any noticeset system syslog time-format millisecondWhy: All messages at notice and above go to 192.0.2.50.
set system syslog console any noticeset system syslog file messages any noticeset system syslog file messages authorization infoWhy: Logs go to the console and a local file, but not to a remote host.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config | fail | FAIL |
Framework mapping. The rule provides evidence towards these controls. It does not certify anything.
| Framework | Reference |
|---|---|
| NIST SP 800-53 | AU-2, AU-12 |
| NIST CSF 1.1 | DE.CM-1 |
| HIPAA (45 CFR) | 164.312(b) |
| ISO/IEC 27001:2022 Annex A | A.8.15 |
Tested with: sample excerpts from Junos 15.1 (synthetic) and Junos 23.2 (synthetic). Minimum rConfig 8.0.0 (must_match_regex). Editions: Pro, Vector, Enterprise.
Remote syslog for login messages
Authorisation messages record who logged in and what they were allowed to do. This rule needs a remote host that gets the authorization facility at info or any.
// A remote syslog host receives authorization messages at info or any (set system syslog host ... authorization info)#[must_match_regex]/^set system syslog host \S+ authorization (info|any)$/mset system syslog host 192.0.2.50 any noticeset system syslog host 192.0.2.50 authorization infoset system syslog file messages any noticeWhy: Authorisation messages go to 192.0.2.50.
set system syslog console any noticeset system syslog file messages any noticeset system syslog file messages authorization infoWhy: Authorisation messages only go to a local file.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config | fail | FAIL |
Framework mapping. The rule provides evidence towards these controls. It does not certify anything.
| Framework | Reference |
|---|---|
| NIST SP 800-53 | AU-2, AU-12 |
| HIPAA (45 CFR) | 164.312(b) |
| ISO/IEC 27001:2022 Annex A | A.8.15 |
Tested with: sample excerpts from Junos 15.1 (synthetic) and Junos 23.2 (synthetic). Minimum rConfig 8.0.0 (must_match_regex). Editions: Pro, Vector, Enterprise.
Millisecond timestamps
Timestamps with milliseconds let you put events from many devices in the right order. This rule needs set system syslog time-format millisecond, with or without year.
// Syslog timestamps include milliseconds (set system syslog time-format millisecond)#[must_match_regex]/^set system syslog time-format (year )?millisecond$/mset system syslog file messages any noticeset system syslog time-format millisecondWhy: Timestamps include milliseconds.
set system syslog console any noticeset system syslog file messages any noticeWhy: There is no time-format line.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config | fail | FAIL |
Framework mapping. The rule provides evidence towards these controls. It does not certify anything.
| Framework | Reference |
|---|---|
| NIST SP 800-53 | AU-2, AU-12 |
| HIPAA (45 CFR) | 164.312(b) |
| ISO/IEC 27001:2022 Annex A | A.8.15 |
Tested with: sample excerpts from Junos 15.1 (synthetic) and Junos 23.2 (synthetic). Minimum rConfig 8.0.0 (must_match_regex). Editions: Pro, Vector, Enterprise.
No console logging
Log messages on the console slow the device down when there are many, and nobody is usually watching. This rule fails on any set system syslog console line.
// Console logging is off (fails on set system syslog console)#[must_not_match_regex]/^set system syslog console /mset system syslog host 192.0.2.50 any noticeset system syslog file messages any noticeWhy: There is no syslog console line.
set system syslog console any noticeset system syslog file messages any noticeWhy: Messages are sent to the console.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config | fail | FAIL |
Framework mapping. The rule provides evidence towards these controls. It does not certify anything.
| Framework | Reference |
|---|---|
| HIPAA (45 CFR) | 164.312(b) |
Tested with: sample excerpts from Junos 15.1 (synthetic) and Junos 23.2 (synthetic). Minimum rConfig 8.0.2 (must_not_match_regex). Editions: Pro, Vector, Enterprise.
Time zone is UTC
If every device uses UTC, log times line up wherever the devices are. UTC is the default, so a config with no time-zone line passes. Any other time zone fails.
// The system time zone is UTC (fails on a set system time-zone line other than UTC, the default)#[must_not_match_regex]/^set system time-zone (?!UTC$)/mset system host-name br-gwy-sw01set system time-zone UTCWhy: The time zone is UTC.
set system host-name br-gwy-sw02set system time-zone Europe/DublinWhy: Europe/Dublin is not UTC.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config | fail | FAIL |
Framework mapping. The rule provides evidence towards these controls. It does not certify anything.
| Framework | Reference |
|---|---|
| None recorded | See Compliance frameworks |
Tested with: sample excerpts from Junos 15.1 (synthetic) and Junos 23.2 (synthetic). Minimum rConfig 8.0.2 (must_not_match_regex). Editions: Pro, Vector, Enterprise.
Related reference
- Juniper Junos policy templates: every rule in
junos-logging.policy, its references and known limitations. - Policy Definitions: the definition file format and every method.
- Policy Assignments: run a definition against your devices.
- Policy Compliance Results: read the pass and fail results.