summaryrefslogtreecommitdiff
path: root/src/journal
AgeCommit message (Collapse)AuthorFilesLines
2019-10-24basic/fs-util: change CHASE_OPEN flag into a separate output parameterZbigniew Jędrzejewski-Szmek1-1/+1
chase_symlinks() would return negative on error, and either a non-negative status or a non-negative fd when CHASE_OPEN was given. This made the interface quite complicated, because dependning on the flags used, we would get two different "types" of return object. Coverity was always confused by this, and flagged every use of chase_symlinks() without CHASE_OPEN as a resource leak (because it would this that an fd is returned). This patch uses a saparate output parameter, so there is no confusion. (I think it is OK to have functions which return either an error or an fd. It's only returning *either* an fd or a non-fd that is confusing.)
2019-10-22journal: Consistently capitalize printed header entriesThibault Nélis1-19/+19
Per comments in https://github.com/systemd/systemd/pull/13808.
2019-09-20tree-wide: say "ratelimit" not "rate_limit"Zbigniew Jędrzejewski-Szmek7-44/+44
"ratelimit" is a real word, so we don't need to use the other form anywhere. We had both forms in various places, let's standarize on the shorter and more correct one.
2019-09-06journal: Make the output of --update-catalog deterministicDaniel Edgecumbe3-28/+28
The use of an unordered hashmap means that the output of 'journalctl --update-catalog' differs between runs despite there being no changes in the input files. By changing all instances of Hashmap to OrderedHashmap we fix this, and now the catalog is reproducible. Motivation: https://reproducible-builds.org Signed-off-by: Daniel Edgecumbe <git@esotericnonsense.com>
2019-08-22journalctl: Make journalctl --user-unit= match on _SYSTEMD_USER_SLICEArian van Putten1-1/+2
journalctl --unit= already did this, and allows you to tail all the logs for a certain slice easily. It seemed only natural to make --user-unit behave in a similar way. The _SYSTEMD_USER_SLICE field was not documented as being added by journald, so I have added that to the documentation too. Furthermore, I have documented the existing behaviour of --unit= and the new behaviour of --user-unit= The behaviour was actually not documented before, so I am also OK with removing the match for the --unit= command instead. The user would then have to manually provide _SYSTEMD_SLICE= filter to journalctl in both cases. Both options work for me.
2019-08-20test-journal-flush: provide at least *some* logsZbigniew Jędrzejewski-Szmek1-2/+5
Ubunut autopkgtest fails with: 405/501 test-journal-flush FAIL 0.74 s (killed by signal 6 SIGABRT) --- command --- SYSTEMD_KBD_MODEL_MAP='/tmp/autopkgtest.BgjJJv/build.yAM/systemd/src/locale/kbd-model-map' SYSTEMD_LANGUAGE_FALLBACK_MAP='/tmp/autopkgtest.BgjJJv/build.yAM/systemd/src/locale/language-fallback-map' PATH='/tmp/autopkgtest.BgjJJv/build.yAM/systemd/build-deb:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games' /tmp/autopkgtest.BgjJJv/build.yAM/systemd/build-deb/test-journal-flush --- stderr --- Assertion 'r >= 0' failed at src/journal/test-journal-flush.c:48, function main(). Aborting. ------- It's hard to say what is going on here without any error messages whatsoever. The test goes into deep details of journal file handling, so it needs to also do logging on its own.
2019-07-26journald: lower keep_free to 5% and raise min_use to 2%Zbigniew Jędrzejewski-Szmek1-49/+38
https://bugzilla.redhat.com/show_bug.cgi?id=1715699 > /dev/mapper/live-rw 6.4G 5.7G 648M 91% / > systemd-journald[905]: Fixed min_use=1.0M max_use=648.7M max_size=81.0M min_size=512.0K keep_free=973.1M n_max_files=100 When journald is started, we pick keep_free as 15% of the disk size. When the fs is almost filled, we will only keep one journal file around and rotate very often (because min_size is very small). Let's set min use to something reasonable, so that we get more useful logs that will cover at least the full boot. Some cases considered in the PR: > /dev/mapper/live-rw 6.4G 5.7G 648M 91% / keep_free→MIN(327,100)→100 MB. min_use→16MB. effective range: 16 MB – 548 MB > /dev/mapper/fedora_krowka-root 78G 69G 5.7G 93% / keep_free → MIN(4GB, 100MB)→100MB min_use→16MB effective range: 16 MB – 5.6 GB (but then there's the max_use limit, which cuts the range down) > 4TB, 4GB free keep_free → MIN(209715, 100) → 100 MB min_use→16MB effective range: 16 MB – 4.9 GB (also effectively limited by max_use) Also replace unneeded width suffixes with spaces, I think this is more readable, and drop DEFAULT_ prefixes in cases where this setting is simply a bound, and cannot be overridden by user config, hence is not a default.
2019-07-19journal: emit debug log about settings only once (or when changed)Zbigniew Jędrzejewski-Szmek1-4/+17
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=902795 https://bugzilla.redhat.com/show_bug.cgi?id=1715699 report "thousands" of those messages. I think this occurs when journald rotates files very quickly. Nevertheless, logging this over and over is not useful, let's do it just once.
2019-07-16journal: properly read unaligned le64 integersLennart Poettering1-3/+4
Fixes: #13051 Replaces: #13064
2019-07-15tree-wide: drop duplicated blank linesYu Watanabe1-1/+0
``` $ for i in */*.[ch] */*/*.[ch]; do sed -e '/^$/ {N; s/\n$//g}' -i $i; done $ git checkout HEAD -- basic/linux shared/linux ```
2019-07-12tree-wide: get rid of strappend()Lennart Poettering5-13/+14
It's a special case of strjoin(), so no need to keep both. In particular as typing strjoin() is even shoert than strappend().
2019-07-11Merge pull request #13011 from keszybz/auto-eraseLennart Poettering1-1/+1
Remove string_erase and friends
2019-07-11Merge pull request #12926 from keszybz/urlify-logsLennart Poettering1-1/+1
Urlify CONFIG_FILE and improve SYSTEMD_LOG_LOCATION
2019-07-10Remove string_eraseZbigniew Jędrzejewski-Szmek1-1/+1
2019-07-05tree-wide: introduce strerror_safe()Yu Watanabe2-2/+2
2019-07-04tree-wide: use PROJECT_FILE instead of __FILE__Zbigniew Jędrzejewski-Szmek1-1/+1
This replaces the internal uses of __FILE__ with the new macro.
2019-07-04meson: create /var/log/journal/{,remote/} conditionallyZbigniew Jędrzejewski-Szmek1-12/+14
Not everybody has those dirs in the filesystem (and they don't need to). When creating an installation package using $DESTDIR, it is easy enough to remove or ignore those directories, but if installing into a real root, it is ugly to create and remove them. Let's add an option so people can skip it if they want. Inspired by #12930.
2019-06-25tree-wide: replace strjoina() with prefix_roota()Yu Watanabe1-2/+2
2019-06-22Merge pull request #12836 from yuwata/tree-wide-replace-strjoinLennart Poettering2-6/+3
tree-wide: replace strjoin() with path_join()
2019-06-21tree-wide: replace strjoin() with path_join()Yu Watanabe2-6/+3
2019-06-20Merge pull request #12837 from yuwata/tree-wide-lgtm-fixesLennart Poettering2-4/+9
tree-wide: fix issues found by lgtm
2019-06-20tree-wide: drop alloca() in loopYu Watanabe2-4/+9
2019-06-19util: introduce format_bytes_full()Yu Watanabe3-2/+3
And move it into format-util.c.
2019-06-18journald: use memdup_suffix0() when copying string from potentially binary dataLennart Poettering1-2/+2
Fixes: #12484
2019-06-12journal: also disable memory tricks when hashing under msanZbigniew Jędrzejewski-Szmek1-3/+3
Might help with #11738.
2019-06-04journalctl: make 'journalctl --flush' or friends not fail with varlink timeoutYu Watanabe1-0/+1
Closes #12570.
2019-06-04journalctl: mention --smart-relinquish-var in log messageYu Watanabe1-1/+1
2019-06-04journalctl: fix error cause in log messageYu Watanabe1-1/+4
If varlink_call() returns negative errno, then `error` is null.
2019-05-30sd-journal: voidify callZbigniew Jędrzejewski-Szmek1-1/+1
To appease coverity, CID#1400674.
2019-05-28journal: use cleanup attribute at one more placeYu Watanabe2-5/+4
2019-05-28journal: do not trigger assertion when journal_file_close() get NULLYu Watanabe2-6/+4
We generally expect destructors to not complain if a NULL argument is passed. Closes #12400.
2019-05-24Merge pull request #12590 from keszybz/unicode-cmdlinesLennart Poettering1-7/+4
Use unicode for cmdline printing
2019-05-22journald: output a proper error message when the journal is used on fs that ↵Lennart Poettering2-0/+11
doesn't do mmap() properly Prompted by: https://lists.freedesktop.org/archives/systemd-devel/2019-May/042708.html
2019-05-22basic/process-util: convert bool arg to flagsZbigniew Jędrzejewski-Szmek1-1/+1
In preparation for the next commit…
2019-05-22Rework cmdline printing to use unicodeZbigniew Jędrzejewski-Szmek1-1/+1
The functions to retrieve and print process cmdlines were based on the assumption that they contain printable ASCII, and everything else should be filtered out. That assumption doesn't hold in today's world, where people are free to use unicode everywhere. This replaces the custom cmdline reading code with a more generic approach using utf8_escape_non_printable_full(). For kernel threads, truncation is done on the parenthesized name, so we'll get "[worker]", "[worker…]", …, "[w…]", "[…", "…" as we reduce the number of available columns. This implementation is most likely slower for very long cmdlines, but I don't think this is very important. The common case is to have short commandlines, and should print those properly. Absurdly long cmdlines are the exception, which needs to be handled correctly and safely, but speed is not too important. Fixes #12532. v2: - use size_t for the number of columns. This change propagates into various other functions that call get_process_cmdline(), increasing the size of the patch, but the changes are rather trivial.
2019-05-21Introduce sc_arg_max() helperZbigniew Jędrzejewski-Szmek1-6/+3
Just a cast and an assert.
2019-05-16Merge pull request #12535 from poettering/color-greyZbigniew Jędrzejewski-Szmek1-1/+1
redefine how we select the ANSI color grey
2019-05-16journalctl: return a non-zero EC when --grep returns no matchesFrantisek Sumsal1-1/+9
When journalctl is compiled with PCRE2 support, let's return a non-zero exit code when --grep is used and no match for given pattern is found. This should allow users to use journalctl --grep in scripts instead of piping journalctl into grep Fixes #8152
2019-05-10journalctl: don't output ANSI sequences if disabledLennart Poettering1-1/+1
2019-05-10journalctl: improve error messagesZbigniew Jędrzejewski-Szmek1-2/+4
Follow-up for #12230.
2019-05-10Use sd_event_source_disable_unref()Zbigniew Jędrzejewski-Szmek1-2/+1
2019-05-09journalctl: add new --relinquish and --smart-relinquish optionsLennart Poettering1-59/+104
The latter is identical to the former, but becomes a NOP if /var/log/journal is on the same mount as /, and thus during shutdown unmounting /var is not necessary and hence we can keep logging until the very end.
2019-05-09journald: add API to move logging from /var to /run againLennart Poettering1-19/+57
We now have this nice little Varlink API, let's beef it up a bit.
2019-05-09journalctl: port --flush/--sync/--rotate to use varlink method callsLennart Poettering2-138/+72
2019-05-09journald: also offer flush/rotate/sync as varlink method callsLennart Poettering2-11/+117
This makes the operations previously available via asynchronous signals also available as regular varlink method calls, i.e. with sane completion.
2019-05-08Merge pull request #12411 from keszybz/pr/12394Lennart Poettering2-0/+2
run: when emitting the calendarspec warning, use red
2019-05-08Enable log colors for most of tools in /usr/binZbigniew Jędrzejewski-Szmek2-0/+2
When emitting the calendarspec warning we want to see some color. Follow-up for 04220fda5c. Exceptions: - systemctl, because it has a lot hand-crafted coloring - tmpfiles, sysusers, stdio-bridge, etc, because they are also used in services and I'm not sure if this wouldn't mess up something.
2019-04-29codespell: fix spelling errorsBen Boeckel5-6/+6
2019-04-12journald: modernize config_parse_compress() a bitLennart Poettering1-20/+28
2019-04-12journald: rebreak a few commentsLennart Poettering1-28/+18