Check Logging

The following scenario shows how to display and register user actions performed on the OSDx CLI (Command Line Interface).

Test CLI Events Logging

Description

This scenario demonstrates how to show and store in a file the different actions that users perform on the CLI.

Scenario

Step 1: Set the following configuration in DUT0:

set system description DESC1
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Run command system journal show | tail -n 20 at DUT0 and expect this output:

Show output
Oct 30 13:31:24.294532 osdx systemd-journald[1923]: Runtime Journal (/run/log/journal/877522c656344df9b9ad28416f5f036f) is 2.0M, max 15.3M, 13.2M free.
Oct 30 13:31:24.295216 osdx systemd-journald[1923]: Received client request to rotate journal, rotating.
Oct 30 13:31:24.295266 osdx systemd-journald[1923]: Vacuuming done, freed 0B of archived journals from /run/log/journal/877522c656344df9b9ad28416f5f036f.
Oct 30 13:31:24.303925 osdx OSDxCLI[361177]: User 'admin' executed a new command: 'system journal clear'.
Oct 30 13:31:24.618883 osdx osdx-coredump[361713]: Deleting all coredumps in /opt/vyatta/etc/config/coredump...
Oct 30 13:31:24.624424 osdx zebra[1601]: [RZ3YY-GPH41][EC 100663310] snmp[warning]: Warning: Failed to connect to the agentx master agent ([NIL]):
Oct 30 13:31:24.624469 osdx zebra[1601]: [RZ3YY-GPH41][EC 100663310] snmp[warning]: Warning: Failed to connect to the agentx master agent ([NIL]):
Oct 30 13:31:24.626448 osdx OSDxCLI[361177]: User 'admin' executed a new command: 'system coredump delete all'.
Oct 30 13:31:25.109117 osdx OSDxCLI[361177]: User 'admin' entered the configuration menu.
Oct 30 13:31:25.175417 osdx OSDxCLI[361177]: User 'admin' added a new cfg line: 'set system description DESC1'.
Oct 30 13:31:25.276746 osdx ERROR[361719]: unexpected
                                           Traceback (most recent call last):
                                             File "osdx/bin/op/fan_control.py", line 23, in _send_fan_control_cmd
                                           FileNotFoundError: [Errno 2] No such file or directory
Oct 30 13:31:25.278440 osdx OSDxCLI[361177]: User 'admin' added a new cfg line: 'show working'.
Oct 30 13:31:25.348334 osdx cfgd[1636]: [361177]Completed change to active configuration
Oct 30 13:31:25.350390 osdx OSDxCLI[361177]: User 'admin' committed the configuration.
Oct 30 13:31:25.385246 osdx OSDxCLI[361177]: User 'admin' left the configuration menu.

Step 3: Run command system login show users at DUT0 and expect this output:

Show output
NAME     LINE         TIME             COMMENT
admin    ttyS0        2024-10-30 13:31

Step 4: Run command system journal show | tail -n 20 at DUT0 and expect this output:

Show output
Oct 30 13:31:24.294532 osdx systemd-journald[1923]: Runtime Journal (/run/log/journal/877522c656344df9b9ad28416f5f036f) is 2.0M, max 15.3M, 13.2M free.
Oct 30 13:31:24.295216 osdx systemd-journald[1923]: Received client request to rotate journal, rotating.
Oct 30 13:31:24.295266 osdx systemd-journald[1923]: Vacuuming done, freed 0B of archived journals from /run/log/journal/877522c656344df9b9ad28416f5f036f.
Oct 30 13:31:24.303925 osdx OSDxCLI[361177]: User 'admin' executed a new command: 'system journal clear'.
Oct 30 13:31:24.618883 osdx osdx-coredump[361713]: Deleting all coredumps in /opt/vyatta/etc/config/coredump...
Oct 30 13:31:24.624424 osdx zebra[1601]: [RZ3YY-GPH41][EC 100663310] snmp[warning]: Warning: Failed to connect to the agentx master agent ([NIL]):
Oct 30 13:31:24.624469 osdx zebra[1601]: [RZ3YY-GPH41][EC 100663310] snmp[warning]: Warning: Failed to connect to the agentx master agent ([NIL]):
Oct 30 13:31:24.626448 osdx OSDxCLI[361177]: User 'admin' executed a new command: 'system coredump delete all'.
Oct 30 13:31:25.109117 osdx OSDxCLI[361177]: User 'admin' entered the configuration menu.
Oct 30 13:31:25.175417 osdx OSDxCLI[361177]: User 'admin' added a new cfg line: 'set system description DESC1'.
Oct 30 13:31:25.276746 osdx ERROR[361719]: unexpected
                                           Traceback (most recent call last):
                                             File "osdx/bin/op/fan_control.py", line 23, in _send_fan_control_cmd
                                           FileNotFoundError: [Errno 2] No such file or directory
Oct 30 13:31:25.278440 osdx OSDxCLI[361177]: User 'admin' added a new cfg line: 'show working'.
Oct 30 13:31:25.348334 osdx cfgd[1636]: [361177]Completed change to active configuration
Oct 30 13:31:25.350390 osdx OSDxCLI[361177]: User 'admin' committed the configuration.
Oct 30 13:31:25.385246 osdx OSDxCLI[361177]: User 'admin' left the configuration menu.
Oct 30 13:31:25.522709 osdx OSDxCLI[361177]: User 'admin' executed a new command: 'system journal show | tail -n 20'.
Oct 30 13:31:25.585782 osdx OSDxCLI[361177]: User 'admin' executed a new command: 'system login show users'.

Step 5: Modify the following configuration lines in DUT0:

set system syslog file CLI filter def app OSDxCLI
set system syslog file CLI filter def level info

Step 6: Login as admin user on DUT0.

Step 7: Modify the following configuration lines in DUT0:

set system description DESC2

Step 8: Run command file show running://log/user/CLI/CLI at DUT0 and expect this output:

Show output
2024-10-30 13:31:26.208331 auth-notice , OSDxCLI:  User 'admin' committed the configuration.
2024-10-30 13:31:26.223798 auth-notice , OSDxCLI:  User 'admin' left the configuration menu.
2024-10-30 13:31:26.308732 auth-notice , OSDxCLI:  User 'admin' has logged out.
2024-10-30 13:31:27.888004 auth-notice , OSDxCLI:  User 'admin' has logged in.
2024-10-30 13:31:28.017486 auth-notice , OSDxCLI:  User 'admin' entered the configuration menu.
2024-10-30 13:31:28.083291 auth-notice , OSDxCLI:  User 'admin' added a new cfg line: 'set system description DESC2'.
2024-10-30 13:31:28.179926 auth-notice , OSDxCLI:  User 'admin' added a new cfg line: 'show changes'.
2024-10-30 13:31:28.249051 auth-notice , OSDxCLI:  User 'admin' committed the configuration.
2024-10-30 13:31:28.293767 auth-notice , OSDxCLI:  User 'admin' left the configuration menu.