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 Mon 2024-12-02 19:45:18 UTC, end at Mon 2024-12-02 19:45:20 UTC. -- Dec 02 19:45:18.535134 osdx systemd-journald[31677]: Runtime journal (/run/log/journal/1d07d1333cb24d498692b025d3740112) is 1.0M, max 16.0M, 15.0M free. Dec 02 19:45:18.566785 osdx OSDxCLI[31459]: User 'admin' executed a new command: 'system journal clear'. Dec 02 19:45:19.435769 osdx osdx-coredump[31728]: Deleting all coredumps in /opt/vyatta/etc/config/coredump... Dec 02 19:45:19.444526 osdx OSDxCLI[31459]: User 'admin' executed a new command: 'system coredump delete all'. Dec 02 19:45:20.454026 osdx OSDxCLI[31459]: User 'admin' entered the configuration menu. Dec 02 19:45:20.583552 osdx OSDxCLI[31459]: User 'admin' added a new cfg line: 'set system description DESC1'. Dec 02 19:45:20.715870 osdx cfgd[1120]: [31459]Completed change to active configuration Dec 02 19:45:20.721016 osdx OSDxCLI[31459]: User 'admin' committed the configuration. Dec 02 19:45:20.763407 osdx OSDxCLI[31459]: 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-12-02 19:45
Step 4: Run command system journal show | tail -n 20
at DUT0
and expect this output:
Show output
-- Logs begin at Mon 2024-12-02 19:45:18 UTC, end at Mon 2024-12-02 19:45:21 UTC. -- Dec 02 19:45:18.535134 osdx systemd-journald[31677]: Runtime journal (/run/log/journal/1d07d1333cb24d498692b025d3740112) is 1.0M, max 16.0M, 15.0M free. Dec 02 19:45:18.566785 osdx OSDxCLI[31459]: User 'admin' executed a new command: 'system journal clear'. Dec 02 19:45:19.435769 osdx osdx-coredump[31728]: Deleting all coredumps in /opt/vyatta/etc/config/coredump... Dec 02 19:45:19.444526 osdx OSDxCLI[31459]: User 'admin' executed a new command: 'system coredump delete all'. Dec 02 19:45:20.454026 osdx OSDxCLI[31459]: User 'admin' entered the configuration menu. Dec 02 19:45:20.583552 osdx OSDxCLI[31459]: User 'admin' added a new cfg line: 'set system description DESC1'. Dec 02 19:45:20.715870 osdx cfgd[1120]: [31459]Completed change to active configuration Dec 02 19:45:20.721016 osdx OSDxCLI[31459]: User 'admin' committed the configuration. Dec 02 19:45:20.763407 osdx OSDxCLI[31459]: User 'admin' left the configuration menu. Dec 02 19:45:20.944104 osdx OSDxCLI[31459]: User 'admin' executed a new command: 'system journal show | tail -n 20'. Dec 02 19:45:21.107871 osdx OSDxCLI[31459]: 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’, ‘VENDOR’: ‘Teldat’, ‘LICENSE’: ‘VM’, ‘ETH0’: ‘eth0’, ‘ETH1’: ‘eth1’, ‘CPUS’: ‘4’, ‘MEM’: ‘2049’, ‘CMD_TIMEOUT’: ’20s’, ‘REBOOT_TIMEOUT’: ‘300s’, ‘UPDATE_TIMEOUT’: ‘600s’, ‘COMMIT_TIMEOUT’: ’60s’, ‘PORT’: 4000, ‘ALIAS’: ‘DUT0’, ‘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: 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
2024-12-02 19:45:21.986450 auth-notice , OSDxCLI: User 'admin' committed the configuration. 2024-12-02 19:45:22.036613 auth-notice , OSDxCLI: User 'admin' left the configuration menu. 2024-12-02 19:45:22.150866 auth-notice , OSDxCLI: User 'admin' has logged out. 2024-12-02 19:45:24.172905 auth-notice , OSDxCLI: User 'admin' has logged in. 2024-12-02 19:45:24.371111 auth-notice , OSDxCLI: User 'admin' entered the configuration menu. 2024-12-02 19:45:24.514959 auth-notice , OSDxCLI: User 'admin' added a new cfg line: 'set system description DESC2'. 2024-12-02 19:45:24.714472 auth-notice , OSDxCLI: User 'admin' committed the configuration. 2024-12-02 19:45:24.755669 auth-notice , OSDxCLI: User 'admin' left the configuration menu.