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 2024-06-13 00:13:26 UTC, end at Thu 2024-06-13 00:13:28 UTC. --
Jun 13 00:13:26.000449 osdx systemd-timedated[2023]: Changed local time to Thu Jun 13 00:13:26 2024
Jun 13 00:13:26.002831 osdx OSDxCLI[24222]: User 'admin' executed a new command: 'set date 2024-06-13 00:13:26'.
Jun 13 00:13:26.385576 osdx systemd-journald[1508]: Runtime journal (/run/log/journal/f8d19df27e8d4f24a0b0e24ed9aec425) is 4.0M, max 16.0M, 11.9M free.
Jun 13 00:13:26.419818 osdx OSDxCLI[24222]: User 'admin' executed a new command: 'system journal clear'.
Jun 13 00:13:27.068952 osdx osdx-coredump[2056]: Deleting all coredumps in /opt/vyatta/etc/config/coredump...
Jun 13 00:13:27.077211 osdx OSDxCLI[24222]: User 'admin' executed a new command: 'system coredump delete all'.
Jun 13 00:13:27.967445 osdx OSDxCLI[24222]: User 'admin' entered the configuration menu.
Jun 13 00:13:28.108796 osdx OSDxCLI[24222]: User 'admin' added a new cfg line: 'set system description DESC1'.
Jun 13 00:13:28.278666 osdx cfgd[1122]: [24222]Completed change to active configuration
Jun 13 00:13:28.282806 osdx OSDxCLI[24222]: User 'admin' committed the configuration.
Jun 13 00:13:28.328244 osdx OSDxCLI[24222]: 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-06-13 00:06

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

Show output
-- Logs begin at Thu 2024-06-13 00:13:26 UTC, end at Thu 2024-06-13 00:13:28 UTC. --
Jun 13 00:13:26.000449 osdx systemd-timedated[2023]: Changed local time to Thu Jun 13 00:13:26 2024
Jun 13 00:13:26.002831 osdx OSDxCLI[24222]: User 'admin' executed a new command: 'set date 2024-06-13 00:13:26'.
Jun 13 00:13:26.385576 osdx systemd-journald[1508]: Runtime journal (/run/log/journal/f8d19df27e8d4f24a0b0e24ed9aec425) is 4.0M, max 16.0M, 11.9M free.
Jun 13 00:13:26.419818 osdx OSDxCLI[24222]: User 'admin' executed a new command: 'system journal clear'.
Jun 13 00:13:27.068952 osdx osdx-coredump[2056]: Deleting all coredumps in /opt/vyatta/etc/config/coredump...
Jun 13 00:13:27.077211 osdx OSDxCLI[24222]: User 'admin' executed a new command: 'system coredump delete all'.
Jun 13 00:13:27.967445 osdx OSDxCLI[24222]: User 'admin' entered the configuration menu.
Jun 13 00:13:28.108796 osdx OSDxCLI[24222]: User 'admin' added a new cfg line: 'set system description DESC1'.
Jun 13 00:13:28.278666 osdx cfgd[1122]: [24222]Completed change to active configuration
Jun 13 00:13:28.282806 osdx OSDxCLI[24222]: User 'admin' committed the configuration.
Jun 13 00:13:28.328244 osdx OSDxCLI[24222]: User 'admin' left the configuration menu.
Jun 13 00:13:28.513363 osdx OSDxCLI[24222]: User 'admin' executed a new command: 'system journal show | tail -n 20'.
Jun 13 00:13:28.642294 osdx OSDxCLI[24222]: 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’, ‘CPUS’: ‘4’, ‘MEM’: ‘2049’, ‘MON_PORT’: ‘5000’, ‘MON_ALIAS’: ‘VM0_MON’, ‘ADDR’: ‘localhost’, ‘CMD_TIMEOUT’: ’10s’, ‘REBOOT_TIMEOUT’: ‘300s’, ‘UPDATE_TIMEOUT’: ‘600s’, ‘COMMIT_TIMEOUT’: ’60s’, ‘IMAGE_STORAGE’: ‘True’, ‘ALIAS’: ‘DUT0’, ‘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-06-13 00:13:29.517419 auth-notice , OSDxCLI:  User 'admin' committed the configuration.
2024-06-13 00:13:29.559982 auth-notice , OSDxCLI:  User 'admin' left the configuration menu.
2024-06-13 00:13:29.687733 auth-notice , OSDxCLI:  User 'admin' has logged out.
2024-06-13 00:13:31.574113 auth-notice , OSDxCLI:  User 'admin' has logged in.
2024-06-13 00:13:31.791764 auth-notice , OSDxCLI:  User 'admin' entered the configuration menu.
2024-06-13 00:13:31.933346 auth-notice , OSDxCLI:  User 'admin' added a new cfg line: 'set system description DESC2'.
2024-06-13 00:13:32.087561 auth-notice , OSDxCLI:  User 'admin' committed the configuration.
2024-06-13 00:13:32.133030 auth-notice , OSDxCLI:  User 'admin' left the configuration menu.