slog2info
Display messages from the system log
Syntax:
slog2info [-acfinSstVvWw] [-b bset1,bset2,...] [-d path]
[-e code1,code2,...] [-l filename] [-r [resetfilename]]
Runs on:
QNX OS
Options:
- -a
- Highlight logs with ANSI terminal color-codes. Logs of different severity levels are shown with different text/background colors for readability. This might not be formatted correctly on all terminals and emulators.
- -b bset1,bset2,...
- Parse only the logs of the given buffer set names. You can also specify this as:
-b bset1 -b bset2 -b ...
- -c
- Clear the live slog2 buffers. You can use this option with -b to clear specific buffer sets.
- -d path
- Specify the directory that contains slogger2 buffer sets. This is only for static snapshots.
- -f
- Format the timestamp as epoch_seconds.milliseconds.
- -e code1,code2,...
- Parse only the logs that match one of the specified event code numbers.
- -i
- Display information about a buffer set specified by the -l option.
- -l filename
- (
el
) The buffer set file to parse. This lets you select a PID-specific buffer set. The filename argument can be the relative path of a file under /dev/shmem/slogger2/. - -n
- Discard newline ('\n') characters from logs. Display each line in a multiline log as a separate log line in the output.
- -r resetfilename
- Display logs preserved through the most recent reset. Optionally specify a reset file to display logs from another reset.
- -S
- Show the severity level for each log line as one of: SLOG2_SHUTDOWN, SLOG2_CRITICAL, SLOG2_ERROR, SLOG2_WARNING, SLOG2_NOTICE, SLOG2_INFO, SLOG2_DEBUG1, SLOG2_DEBUG2.
- -s
- Show the numeric severity level for each log line, where 0 corresponds to SLOG2_SHUTDOWN, and 7 corresponds to SLOG2_DEBUG2.
- -t
- Display the thread ID.
- -V <verbosity>
- Ask slogger2 to change the verbosity on buffer sets.
- Combined with [-b]: by name.
- Combined with [-l]: by filename.
- With neither [-b] nor [-l]: all buffer sets.
- -v
- Parse buffers that were registered with the series of SLOG2_HINT_SKIP_BUFFER_* flags for slog2_register().
- -W, -w
- Wait mode; listen for new prints. Press Ctrl C to stop. The -w option prints all currently active, available older logs and starts livestreaming; -W ignores all older logs and starts livestreaming active logs from the current moment.
Description:
The slog2info utility displays the contents of the system log buffer managed by slogger2, which must be running to record these messages.
If you don't specify any options, slog2info displays all the logs.
Output format:
The slog2info utility returns the contents of the system log buffer as log lines. Each line is a row that, by default, contains data arranged in five columns. For example:
# slog2info
Dec 21 21:12:00.029 server_monitor.4104 events* 0 200 pulses in private pulse pool
[Logging time] [Buffer set name] [Buffer name] [User-defined code] [Log contents]
- Logging time
- The date and time of the log entry.
- Buffer set name
- The buffer set name as found under /dev/shmem/slogger2. The numeric value is the process ID (PID) of the owner process.
- Buffer name
- The buffer name within the buffer set. An asterisk (*) indicates it's the oldest packet found in the buffer.
- User-defined code
- User-defined code from the logging APIs.
- Log contents
- The payload of the log message.
Some slog2info command options create additional columns in the terminal output. For example, supplying the thread ID option (-t) returns the thread ID in a column to the left of the user-defined code:
# slog2info -t
Dec 21 21:12:00.029 server_monitor.4104 events* 1 0 200 pulses in private pulse pool
[Logging time] [Buffer set name] [Buffer name] [Thread ID] [User-defined code] [Log contents]
If you supply the severity option (-s), the command returns the severity in a column to the right of the user-defined code. In this case, the returned severity is 5:
# slog2info -s
Dec 21 21:12:00.029 server_monitor.4104 events* 0 5 200 pulses in private pulse pool
[Logging time] [Buffer set name] [Buffer name] [User-defined code] [Severity] [Log contents]
Alternatively, you can return the severity level in a human-readable format by supplying the (-S) option:
# slog2info -S
Dec 21 21:12:00.029 server_monitor.4104 events* 0 SLOG2_INFO 200 pulses in private pulse pool
[Logging time] [Buffer set name] [Buffer name] [User-defined code] [Severity] [Log contents]
Supplying the (-f) option returns the logging time as seconds since epoch. For example:
# slog2info -f
4511797920.029 server_monitor.4104 events* 0 200 pulses in private pulse pool
[Logging time] [Buffer set name] [Buffer name] [User-defined code] [Log contents]
Usage examples:
# slog2info
# slog2info -l /dev/shmem/slogger2/dumper.8201
buffer_set_name=dumper, num_buffers=1
buffer_name=dumper
# slog2info -l /dev/shmem/slogger2/server_monitor.4104
buffer_set_name=server_monitor, num_buffers=1
buffer_name=events
4511797920.029 server_monitor.4104 events* 0 200 pulses in private pulse pool
[Logging time] [Buffer set name] [Buffer name] [User-defined code] [Log contents]
# slog2info -b my_test_buff
# slog2info -r
# slog2info -r -b my_test_buff
# slog2info -i -l /dev/shmem/slogger2/server_monitor.4104
buffer_set_name=server_monitor, num_buffers=1, verbosity_level=5
[0] : buffer_name: events, buffer_size: 4096
# slog2info -w
# slog2info -V1 -b my_test
# slog2info -V5 -l my_test.1234