action #109792
closed[qe-core] Offline extraction of logs from Serial console
0%
Description
There might be cases where it could be convenient to extract the logs via journal or serial console, due to limitations, network availability or simply convenience, for post processing.
Ideally openQA would do something like:
cat EOF ---BEGIN OPENQA LOGFILE $test_module $log_filename ---
$log
---END OPENQA LOGFILE $test_module $log_filename ---
EOF > $serialdev
Ideally or something like this:
`echo "MAKER" $( $log_string | gzip | base64encode) "END MAKER" > $serialdev`
as a concept, this is what we want: journalctl -k | tail --lines 100 | gzip | base64 | base64 -d | zcat
, os-autoinst acts here in the decoding part base64 -d | zcat
to extract the files from the logs.
Upon test completion, a program monitoring the amqp events would parse the serial log, and split it into the multiple parts and upload the results to the corresponding job. It should, base64 encoding + gzip could be used to reduce the ammount of lines in the serial log.
See https://amqp.opensuse.org for o3 and for OSD the URL is configured here: https://gitlab.suse.de/openqa/salt-pillars-openqa/-/blob/master/openqa/server.sls, see https://suse.slack.com/archives/C02CANHLANP/p1649672715876659?thread_ts=1649671726.929779&cid=C02CANHLANP for a thread in Slack
This would help further down the line, making investigation of isolated systems, or certain corner cases easier to debug.
Acceptance Criteria¶
- A method that allows streaming data to the serial console, compresed and encoded with base64 (check if jeos, sle-micro don't have required binaries)
- Write a daemon that listens for events on jobs running on functional, that extracts the logs and uploads them to the corresponding job, once it has finished
See also: https://openqa.suse.de/tests/8533774#step/systemd_sapstart_check/44 for a test that runs without network
Constraints¶
Use serial console, if it proves unreliable, system journal should be looked at (do mind the kernel rate limiting for messages)
suggestions:¶
Another idea is to save the logs to the ulogs directory, directly from the perl code
Updated by szarate over 2 years ago
- Subject changed from [qe-core] Offline extraction of logs to [qe-core] Offline extraction of logs from Serial console
Updated by szarate over 2 years ago
sub log2serial {
`journalctl -k | gzip | base64encode > $serialdev`
}
Updated by szarate over 2 years ago
- Related to action #109789: [qe-core] generate a list of installed packages in the system at the end of a test added
Updated by szarate over 2 years ago
- Checklist item deleted (
Add method in the test distribution to content to the serial console, taking compression and encoding into account) - Checklist item deleted (
Write a demon that listens for events on jobs running on functional, that extracts the logs and uploads them to the corresponding job, once it has finished) - Description updated (diff)
- Category set to Enhancement to existing tests
Updated by szarate over 2 years ago
- Sprint set to QE-Core: April Sprint (Apr 13 - May 11)
Updated by szarate over 2 years ago
- Related to action #110097: [sle][migration][sle15sp4] Need investigate how to get scsi id from grub shell page added
Updated by szarate over 2 years ago
- Sprint deleted (
QE-Core: April Sprint (Apr 13 - May 11))
Updated by szarate over 2 years ago
- Sprint set to QE-Core: July Sprint (Jul 06 - Aug 03)
Updated by dheidler over 2 years ago
Why would we need to have any external service reacting on some AMQP events?
We could simply use script_output()
.
Updated by szarate over 2 years ago
dheidler wrote:
Why would we need to have any external service reacting on some AMQP events?
We could simply usescript_output()
.
So long the test ends up with those files, I'm ok with whichever solution you design :p
Updated by zluo over 2 years ago
- Assignee set to zluo
will check this.
@szarate which stage could be involved? POST_FALL_HOOK or at stage uploading logs( file name would be helpful)?
Updated by szarate over 2 years ago
@zluo, for the first part,ideally this would happen on the uploading_logs stage, if the filename is not provided, use the name of the test module...
We're looking to wrap the curl
call that uploads the logs, and detect if the SUT has no network and do the thing... if you're going to try to save the script_output
to ulogs
in the worker, as Dominik mentions earlier, it's even easier I would say
Updated by szarate over 2 years ago
well, I found out that is working on my local host like:
sub log2serial {
journalctl -k | gzip | base64 -w0 > /tmp/test_module.zip
}
you can do:
use Mojo::File;
my $data = script_output(`journalctl -k | gzip | base64 -w0`);
path("ulogs/$logname")->sprut($data); # save the logs to the ulogs directory on the worker directly
when the test is finished, the worker should upload the files on its own, script_output should be able to handle all that data
PS: no need to mark the comments as private, this is a public project :)
Updated by zluo over 2 years ago
- Status changed from Workable to In Progress
Updated by zluo over 2 years ago
- Start date changed from 2022-04-11 to 2022-07-21
Updated by szarate over 2 years ago
- Related to action #114433: [qe-core] call systemctl list-timers --all prior shutdown of the system added
Updated by szarate over 2 years ago
- Sprint changed from QE-Core: July Sprint (Jul 06 - Aug 03) to QE-Core: August Sprint (Aug 03 - Aug 31)
Updated by zluo over 2 years ago
Updated by szarate over 2 years ago
- Related to coordination #68794: [qe-core][functional][epic] rework postfail hooks added