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
May 11 21:02:13.436687 osdx systemd-journald[1583]: Runtime Journal (/run/log/journal/f55f446d40464b198e70fbabb9c21674) is 2.0M, max 15.3M, 13.2M free. May 11 21:02:13.437752 osdx systemd-journald[1583]: Received client request to rotate journal, rotating. May 11 21:02:13.437827 osdx systemd-journald[1583]: Vacuuming done, freed 0B of archived journals from /run/log/journal/f55f446d40464b198e70fbabb9c21674. May 11 21:02:13.455912 osdx OSDxCLI[74400]: User 'admin' executed a new command: 'system journal clear'. May 11 21:02:13.984816 osdx osdx-coredump[74917]: Deleting all coredumps in /opt/vyatta/etc/config/coredump... May 11 21:02:13.994743 osdx OSDxCLI[74400]: User 'admin' executed a new command: 'system coredump delete all'. May 11 21:02:14.759997 osdx OSDxCLI[74400]: User 'admin' entered the configuration menu. May 11 21:02:14.915069 osdx OSDxCLI[74400]: User 'admin' added a new cfg line: 'set system description DESC1'. May 11 21:02:15.049412 osdx OSDxCLI[74400]: User 'admin' added a new cfg line: 'show working'. May 11 21:02:15.203029 osdx cfgd[1244]: [74400]Completed change to active configuration May 11 21:02:15.206260 osdx OSDxCLI[74400]: User 'admin' committed the configuration. May 11 21:02:15.269279 osdx OSDxCLI[74400]: 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 2025-05-11 21:01
Step 4: Run command system journal show | tail -n 20
at DUT0
and expect this output:
Show output
May 11 21:02:13.436687 osdx systemd-journald[1583]: Runtime Journal (/run/log/journal/f55f446d40464b198e70fbabb9c21674) is 2.0M, max 15.3M, 13.2M free. May 11 21:02:13.437752 osdx systemd-journald[1583]: Received client request to rotate journal, rotating. May 11 21:02:13.437827 osdx systemd-journald[1583]: Vacuuming done, freed 0B of archived journals from /run/log/journal/f55f446d40464b198e70fbabb9c21674. May 11 21:02:13.455912 osdx OSDxCLI[74400]: User 'admin' executed a new command: 'system journal clear'. May 11 21:02:13.984816 osdx osdx-coredump[74917]: Deleting all coredumps in /opt/vyatta/etc/config/coredump... May 11 21:02:13.994743 osdx OSDxCLI[74400]: User 'admin' executed a new command: 'system coredump delete all'. May 11 21:02:14.759997 osdx OSDxCLI[74400]: User 'admin' entered the configuration menu. May 11 21:02:14.915069 osdx OSDxCLI[74400]: User 'admin' added a new cfg line: 'set system description DESC1'. May 11 21:02:15.049412 osdx OSDxCLI[74400]: User 'admin' added a new cfg line: 'show working'. May 11 21:02:15.203029 osdx cfgd[1244]: [74400]Completed change to active configuration May 11 21:02:15.206260 osdx OSDxCLI[74400]: User 'admin' committed the configuration. May 11 21:02:15.269279 osdx OSDxCLI[74400]: User 'admin' left the configuration menu. May 11 21:02:15.450843 osdx OSDxCLI[74400]: User 'admin' executed a new command: 'system journal show | tail -n 20'. May 11 21:02:15.576698 osdx OSDxCLI[74400]: 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 {‘DOC’: ‘SDE’, ‘CAPS’: ‘all -ceetm -bmcast’, ‘FWID’: ‘iso’, ‘VENDOR’: ‘Teldat’, ‘LICENSE’: ‘VM’, ‘CPUS’: ‘4’, ‘MEM’: ‘2049’, ‘CMD_TIMEOUT’: ’20s’, ‘REBOOT_TIMEOUT’: ‘300s’, ‘UPDATE_TIMEOUT’: ‘600s’, ‘COMMIT_TIMEOUT’: ’60s’, ‘PORT’: 4000, ‘ALIAS’: ‘DUT0’, ‘ETH0’: ‘eth0’, ‘ETH1’: ‘eth1’, ‘HDA’: ‘/var/tmp/hd-vm0.img’, ‘MON_PORT’: 5000, ‘MON_ALIAS’: ‘VM0_MON’, ‘ETH0_MAC’: ‘DE:AD:BE:EF:6C:00’, ‘ETH1_MAC’: ‘DE:AD:BE:EF:6C:01’, ‘FW_NAME’: ‘os_iso.iso’, ‘ROBOT_IP’: ‘10.215.168.64’, ‘NEEDS_REBOOT’: False, ‘NEEDS_LICENSE’: True}.
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
2025-05-11 21:02:16.457054 auth-notice , OSDxCLI: User 'admin' committed the configuration. 2025-05-11 21:02:16.483099 auth-notice , OSDxCLI: User 'admin' left the configuration menu. 2025-05-11 21:02:16.581372 auth-notice , OSDxCLI: User 'admin' has logged out. 2025-05-11 21:02:18.251986 auth-notice , OSDxCLI: User 'admin' has logged in. 2025-05-11 21:02:18.513478 auth-notice , OSDxCLI: User 'admin' entered the configuration menu. 2025-05-11 21:02:18.644009 auth-notice , OSDxCLI: User 'admin' added a new cfg line: 'set system description DESC2'. 2025-05-11 21:02:18.781844 auth-notice , OSDxCLI: User 'admin' added a new cfg line: 'show changes'. 2025-05-11 21:02:18.958740 auth-notice , OSDxCLI: User 'admin' committed the configuration. 2025-05-11 21:02:18.989279 auth-notice , OSDxCLI: User 'admin' left the configuration menu.