Merged
Conversation
- Export the whole system journal in JSON format (to save complate data, even the values not displayed by default) - Save the journal log with additional data (source code locations) - Save separate libzypp log in the old y2log format - Redirect the output of the logging commands to files, avoid storing huge log files in memory.
jreidinger
reviewed
Mar 20, 2026
jreidinger
reviewed
Mar 24, 2026
jreidinger
approved these changes
Mar 24, 2026
Merged
imobachgs
added a commit
that referenced
this pull request
Apr 14, 2026
Prepare to release version 20. * #3294 * #3295 * #3296 * #3297 * #3298 * #3299 * #3300 * #3301 * #3302 * #3303 * #3304 * #3305 * #3306 * #3307 * #3308 * #3309 * #3310 * #3311 * #3312 * #3313 * #3315 * #3316 * #3317 * #3318 * #3319 * #3320 * #3322 * #3323 * #3325 * #3326 * #3327 * #3329 * #3330 * #3331 * #3333 * #3334 * #3336 * #3338 * #3339 * #3342 * #3343 * #3349 * #3351 * #3352 * #3353 * #3354 * #3356 * #3357 * #3358 * #3359 * #3360 * #3361 * #3362 * #3363 * #3364 * #3365 * #3366 * #3367 * #3368 * #3371 * #3372 * #3373 * #3375 * #3376 * #3378 * #3379 * #3380 * #3381 * #3382 * #3385 * #3386
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
journactlcommand and saving the output to a file.Solution
journalctlfilter which prints the journal in text format but with the additional data we need (source code locations). A simple text log is important for easy debugging.agama logs storewill contain 3 parts:zypp-agama-syscrate are included in the text log as well, this is just to make the libzypp debugging easierNotes
The
journalctlcommand can export the journal data in a binary format which includes all data. But processing that binary dump is not trivial. You need to install thesystemd-journal-remotepackage (not installed by default, fortunately present in SLES16) and convert the binary dump to the native binary journal format which then can be processed by thejournalctlcommand and finally read it as text.That's quite complicated, simple JSON format is much easier to process (using
jqeven from shell). Moreover I'm a bit worried about the binary format compatibility, we need to be able to easily read and process the logs even after 10+ years in the future...Additional enhancements
Technical details
This PR adds two shell scripts which process the systemd journal and print it in text format with more details or in a different format.
agama-journalscriptThis script implements a custom
journalctloutput formatter. The output format is similar to the defaultjournalctloutput, but there some small (but important) changes:Additional values
Removed values
hostname=boot parameter.)I was thinking about using subsecond precision for the time stamps in the output, the journal stores them with microsecond precision. But I think that in reality we need that precision very rarely and if needed the precise time can be always extracted from the saved JSON format, see below.
Of course, the output format can be changed if needed, let's take it as the starting point...
agama-zypp-journalscriptThis script is similar to the
agama-journalscript, but it only exports the libzypp messages and saves them in the old YaST y2log format.It uses custom fields from the journal to print the original libzypp values. For example libzypp uses different error levels than syslog/systemd. Syslog uses level 7 as the lowest debug level, the higher level the lower number, 0 is emergency error. While libzypp/y2log uses 0 for debug and 5 for critical errors, with possibility to use level 999 for temporary debugging. 😃
So when logging a message to journal we have to remap the libzypp error level to journal value. Thanks to using the custom values in the journal we can easily restore the original libzypp levels in this script.
Usage
Both scripts are called when saving the logs and their output is included in the saved tarball log.
But the scripts can be used also interactively when debugging a running system. When running interactively the script colorizes the output based on the error level:
It is possible to show precise time stamps if needed:
Or from a previously stored JSON dump:
journalctl -o json > dump agama-journal --microseconds --input-file dumpThe script passes all unknown parameters to the
journalctlcall so it is possible to do custom filtering, e.g. show all errors reported in the last 5 minutes:agama-journal -p err --since "5 minutes ago"Storing the logs
The new logs are included in the archive created by the
agama logs storecommand:File sizes
The most important part is that the whole saved tarball still fits into the bugzilla attachment size (20MB) and there is still some room available.
Testing