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
Step 2: Run command system journal show | tail -n 20
at DUT0
and expect this output:
Show output
-- Logs begin at Thu 2023-11-23 23:35:08 UTC, end at Thu 2023-11-23 23:35:09 UTC. -- Nov 23 23:35:08.384484 osdx systemd-journald[619]: Runtime journal (/run/log/journal/1b38b2114cf0481baed8058b17ed7ac1) is 4.0M, max 16.0M, 12.0M free. Nov 23 23:35:08.403572 osdx OSDxCLI[30822]: User 'admin' executed a new command: 'system journal clear'. Nov 23 23:35:08.866757 osdx OSDxCLI[30822]: User 'admin' entered the configuration menu. Nov 23 23:35:08.998447 osdx OSDxCLI[30822]: User 'admin' added a new cfg line: 'set system description DESC1'. Nov 23 23:35:09.114391 osdx cfgd[1092]: [30822]Completed change to active configuration Nov 23 23:35:09.117533 osdx OSDxCLI[30822]: User 'admin' committed the configuration. Nov 23 23:35:09.153829 osdx OSDxCLI[30822]: 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 2023-11-23 23:21
Step 4: Run command system journal show | tail -n 20
at DUT0
and expect this output:
Show output
-- Logs begin at Thu 2023-11-23 23:35:08 UTC, end at Thu 2023-11-23 23:35:09 UTC. -- Nov 23 23:35:08.384484 osdx systemd-journald[619]: Runtime journal (/run/log/journal/1b38b2114cf0481baed8058b17ed7ac1) is 4.0M, max 16.0M, 12.0M free. Nov 23 23:35:08.403572 osdx OSDxCLI[30822]: User 'admin' executed a new command: 'system journal clear'. Nov 23 23:35:08.866757 osdx OSDxCLI[30822]: User 'admin' entered the configuration menu. Nov 23 23:35:08.998447 osdx OSDxCLI[30822]: User 'admin' added a new cfg line: 'set system description DESC1'. Nov 23 23:35:09.114391 osdx cfgd[1092]: [30822]Completed change to active configuration Nov 23 23:35:09.117533 osdx OSDxCLI[30822]: User 'admin' committed the configuration. Nov 23 23:35:09.153829 osdx OSDxCLI[30822]: User 'admin' left the configuration menu. Nov 23 23:35:09.310733 osdx OSDxCLI[30822]: User 'admin' executed a new command: 'system journal show | tail -n 20'. Nov 23 23:35:09.406184 osdx OSDxCLI[30822]: User 'admin' executed a new command: 'system login show users'.
Step 5: Set the following configuration in DUT0
:
set system syslog file CLI app OSDxCLI set system syslog file CLI level info
Step 6: Login as admin
user on {‘DOC’: ‘SDE’, ‘CAPS’: ‘all -cellular -ceetm’, ‘FWID’: ‘iso’, ‘LICENSE’: ‘VM’, ‘PORT’: ‘4000’, ‘ETH0’: ‘eth0’, ‘ETH1’: ‘eth1’, ‘MAC0’: ‘DE:AD:BE:EF:6C:10’, ‘MAC1’: ‘DE:AD:BE:EF:6C:11’, ‘HDA’: ‘/var/tmp/hd-vm0.img’, ‘MEM’: ‘2049’, ‘MON_PORT’: ‘5000’, ‘MON_ALIAS’: ‘VM0_MON’, ‘ADDR’: ‘localhost’, ‘CMD_TIMEOUT’: ’20s’, ‘REBOOT_TIMEOUT’: ‘300s’, ‘UPDATE_TIMEOUT’: ‘600s’, ‘COMMIT_TIMEOUT’: ’60s’, ‘DELETE_IMAGES’: ‘True’, ‘ALIAS’: ‘DUT0’, ‘FW_NAME’: ‘os_iso.iso’, ‘NEEDS_REBOOT’: False, ‘NEEDS_LICENSE’: True}.
Step 7: Set the following configuration 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
2023-11-23 23:35:10.088507 auth-notice , OSDxCLI: User 'admin' committed the configuration. 2023-11-23 23:35:10.114325 auth-notice , OSDxCLI: User 'admin' left the configuration menu. 2023-11-23 23:35:10.211427 auth-notice , OSDxCLI: User 'admin' has logged out. 2023-11-23 23:35:12.086824 auth-notice , OSDxCLI: User 'admin' has logged in. 2023-11-23 23:35:12.256828 auth-notice , OSDxCLI: User 'admin' entered the configuration menu. 2023-11-23 23:35:12.349513 auth-notice , OSDxCLI: User 'admin' added a new cfg line: 'set system description DESC2'. 2023-11-23 23:35:12.494569 auth-notice , OSDxCLI: User 'admin' committed the configuration. 2023-11-23 23:35:12.574861 auth-notice , OSDxCLI: User 'admin' left the configuration menu.