| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
We typically want to deal in usec_t, hence let's change the prototype
accordingly, and do proper range checks. Also, make sure are not
confused by negative times.
Do something similar for mktime_or_timegm().
This is a more comprehensive alternative to #34065
Replaces: #34065
|
|
|
|
| |
Currently the extended features are not used, but will be used later.
|
|
|
|
| |
Currently these are not used, but will be used later.
|
|
|
|
|
|
|
| |
The struct itself is generic, and can be used for other ID.
Let's rename it to more generic one.
No functional change, just refactoring and preparation for later
commits.
|
|
|
|
|
|
|
|
|
|
|
|
| |
_SOURCE_BOOTTIME_TIMESTAMP field exists"
This reverts commit f5bdecba08fd3ee11bebc635ea9d17fd97bd33d7.
Some kmsg sent before sleep may be received by systemd-journald after
sleep. In that case, map_clock_usec() does not provide correct
timestamp.
So, _SOURCE_MONOTONIC_TIMESTAMP field is anyway unreliable.
Let's not use the field.
|
|
|
|
|
|
|
| |
field exists
With the previous commit, now the _SOURCE_MONOTONIC_TIMESTAMP field is
usable but only when _SOURCE_BOOTTIME_TIMESTAMP exists.
|
|
|
|
|
|
|
|
|
|
| |
The timestamp is not in CLOCK_MONOTONIC, but CLOCK_BOOTTIME,
while header monotonic timestamp is in CLOCK_MONOTONIC. Hence, we cannot
adjust timestamp by comparing with header monotonic timestamp and
_SOURCE_MONOTONIC_TIMESTAMP field.
Fixes a regression caused by affde1d7e79a634ee6053dbd4a57b3b51b74c170.
Fixes #33293.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is preparation for making our Varlink API a public API. Since our
Varlink API is built on top of our JSON API we need to make that public
first (it's a nice API, but JSON APIs there are already enough, this is
purely about the Varlink angle).
I made most of the json.h APIs public, and just placed them in
sd-json.h. Sometimes I wasn't so sure however, since the underlying data
structures would have to be made public too. If in doubt I didn#t risk
it, and moved the relevant API to src/libsystemd/sd-json/json-util.h
instead (without any sd_* symbol prefixes).
This is mostly a giant search/replace patch.
|
|
|
|
| |
Also mention that -r/--reverse is supported by the command.
|
| |
|
|
|
|
|
| |
Currently, the parsed timestamp is only used when advance_older is
false. Hence, this does not change any behavior. But, let's fix it anyway.
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes a regression introduced by e44f06065bf20e8d0e4adacff61350ebd36f299e.
After the offending commit, if a boot ID suffixed with an offset is
specified to --boot=, the boot ID was ignored.
This fixes the issue.
To fix the issue, this merges journal_find_boot_by_id() and
journal_find_boot_by_offset().
|
|
|
|
|
|
|
|
|
|
|
|
| |
Otherwise, if several matches already set, then the first seek to head
or tail may move the cursor to an invalid place, hence they provide
wrong ID(s). Also, reading journal after calling these function may
provide unexpected data.
Currently, the caller does not install any matches before calling the
functions, and does not read any journal entry after journal_get_boots()
succeeds or journal_find_boot_by_offset() succeeds with 0. Hence, this
should not change any behavior. Just for safety.
|
|
|
|
| |
Follow-up for 8e976dc9209853d5d4d2db3016289f2a5ab99fd9.
|
|
|
|
|
| |
It is always equivalent to getuid(). Let's call getuid() in the
function instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, _SOURCE_REALTIME_TIMESTAMP was only used for realtime
timestamp, and _SOURCE_MONOTONIC_TIMESTAMP was for monotonic.
This make these journal field used more aggressively. If we need
realtime timestamp, but an entry has only _SOURCE_MONOTONIC_TIMESTAMP,
then now realtime timestamp is calculated based on
_SOURCE_MONOTONIC_TIMESTAMP and the header dual timestamp.
Similary, monotonic timestamp is obtained from
_SOURCE_REALTIME_TIMESTAMP and the header dual timestamp.
This should change shown timestamps not so much in most cases, but may
be improve the situation such as #32492.
|
|
|
|
|
| |
No functional change, just refactoring and preparation for later
commits.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In many of our internal functions that take a pointer + a size we have
introduced the rule that SIZE_MAX as size means: take strlen().
sd_journal_add_match() has something similar, but the special value is
0, not SIZE_MAX. This is a bit ugly, since a zero size data block is
theoretically fine. The only reason sd_journal_add_match() gets away
with using this special value is because valid matches must consist of
at least 2 chars, hence cannot be zero.
But let's make this more robust and less surprising when compared to the
rest of our code, and *also* accept SIZE_MAX to mean strlen().
No actual code changes, just some clean-up.
|
|\
| |
| | |
logs-show: several cleanups
|
| |
| |
| |
| | |
No functional change, just refactoring.
|
| |
| |
| |
| |
| |
| |
| | |
And rename it to id128_get_boot_for_machine().
This also splits out id128_get_boot() from sd_id128_get_boot(), and
make id128_get_boot_for_machine() use it.
|
|/
|
|
|
|
|
| |
Fixes a bug introduced in e44f06065bf20e8d0e4adacff61350ebd36f299e: it was
supposed to be a refactoring, but unfortunately FOREACH_ARRAY is implemented
using a for loop, so when the 'goto finish' was replaced by 'break', it only
broke the inner loop, leading to a infinite loop.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, get_display_timestamp() is unconditionally called even if we
will show logs in e.g. json format.
This drops unnecessary call of get_display_timestamp().
This also makes journal fields in each entry parsed only once in
output_short(). Still output_verbose() twice though.
This should improve performance of dumping journals.
Replaces #29365.
Co-authored-by: Costa Tsaousis <costa@netdata.cloud>
|
|
|
|
| |
Co-authored-by: Costa Tsaousis <costa@netdata.cloud>
|
|
|
|
| |
Also use -EBADF when unspecified.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
FORK_DEATHSIG_SIGTERM
Sometimes it makes sense to hard kill a client if we die. Let's hence
add a third FORK_DEATHSIG flag for this purpose: FORK_DEATHSIG_SIGKILL.
To make things less confusing this also renames FORK_DEATHSIG to
FORK_DEATHSIG_SIGTERM to make clear it sends SIGTERM. We already had
FORK_DEATHSIG_SIGINT, hence this makes things nicely symmetric.
A bunch of users are switched over for FORK_DEATHSIG_SIGKILL where we
know it's safe to abort things abruptly. This should make some kernel
cases more robust, since we cannot get confused by signal masks or such.
While we are at it, also fix a bunch of bugs where we didn't take
FORK_DEATHSIG_SIGINT into account in safe_fork()
|
|
|
|
|
|
|
|
| |
We use it for more than just pipe() arrays. For example also for
socketpair(). Hence let's give it a generic name.
Also add EBADF_TRIPLET to mirror this for things like
stdin/stdout/stderr arrays, which we use a bunch of times.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In discover_next_boot(), first we find a new boot ID based on the value
stored in the entry object. Then, find the tail (or head when we are going
upwards) entry of the boot based on the _BOOT_ID= field data.
If boot IDs of an entry in the entry object and _BOOT_ID field data
are inconsistent, which may happen on corrupted journal, then previously
discover_next_boot() failed with -ENODATA.
This makes the function check if the two boot IDs in each entry are
consistent, and skip the entry if not.
Fixes the failure of `journalctl -b -1` for 'truncated' journal:
https://github.com/systemd/systemd/pull/29334#issuecomment-1736567951
|
|
|
|
|
| |
Follows-up for: 0693e6b246053d31c0eb405c6abe9db8a4d00aaf
#29355
|
|\
| |
| | |
journalctl -o short-iso[-precise]: timezone as +02:00 instead of +0200
|
| | |
|
| | |
|
|/ |
|
| |
|
| |
|
|
|
|
|
|
| |
This allows using it with CLEANUP_ARRAY(). For the 2 call sites
where we don't need to free the array, we do a regular for loop
calling json_variant_unref() instead.
|
| |
|
| |
|
|
|
|
|
| |
Journal corruption is not only indicated by EBADMSG but also by
EADDRNOTAVAIL so treat that as corruption in a few more cases.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When displaying log data we deal with two kind of timestamps: the one we
use for display (typically the source timestamp if available), and the
one we use internally (typically the reception timestamp of journald).
The user-facing output modes generally use the display timestamp, the
ones intended for further processing (i.e. json + export outputs) do
not, and directly query the timestamps of the entry, ignoring the
source. This gets a bit confusing, since it's not always clear why we
use which timestamp where. Let's address that by renaming the generic
"ts" parameter/variable to "display_ts" to emphasize that the stored
timestamp are "corrected" timestamps for display only.
No real code change, just some renaming.
|
| |
|
| |
|
|
|
|
| |
SD_ID128_TO_STRING()
|
|
|
|
|
|
|
|
| |
If output fields are specified, let's store this in a Set right-away,
instead of converting between strv and Set again and again for each
line.
This is not only faster, but also simpler and shorter.
|
| |
|