summaryrefslogtreecommitdiff
path: root/src/journal/journalctl.c
AgeCommit message (Collapse)Author
2015-02-03util: rework strappenda(), and rename it strjoina()Lennart Poettering
After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
2015-01-22tmpfiles: add 'a' type to set ACLsZbigniew Jędrzejewski-Szmek
2015-01-19journalctl: trim --help to fit in 80 columnsZbigniew Jędrzejewski-Szmek
Terminals tend to be 80 columns wide by default, and the help text is only supposed to be a terse reminder anyway. https://bugzilla.redhat.com/show_bug.cgi?id=1183771
2015-01-08journal: bump RLIMIT_NOFILE when journal files to 16K (if possible)Lennart Poettering
When there are a lot of split out journal files, we might run out of fds quicker then we want. Hence: bump RLIMIT_NOFILE to 16K if possible. Do these even for journalctl. On Fedora the soft RLIMIT_NOFILE is at 1K, the hard at 4K by default for normal user processes, this code hence bumps this up for users to 4K. https://bugzilla.redhat.com/show_bug.cgi?id=1179980
2015-01-08journald: turn off COW for journal files on btrfsLennart Poettering
btrfs' COW logic results in heavily fragment journal files, which is detrimental for perfomance. Hence, turn off COW for journal files as we create them. Turning off COW comes at the cost of data integrity guarantees, but this should be acceptable, given that we do our own checksumming, and generally have a pretty conservative write pattern. Also see discussion on linux-btrfs: http://www.spinics.net/lists/linux-btrfs/msg41001.html
2015-01-06tree-wide: remove unnecessary LOG_PRIZbigniew Jędrzejewski-Szmek
LOG_DEBUG is already a log level, there is no need to use LOG_PRI which is for filtering out the facility.
2015-01-05journal: install sigbus handler for journal tools tooLennart Poettering
This makes them robust regarding truncation. Ideally, we'd export this as an API, but given how messy SIGBUS handling is, and the uncertain ownership logic of signal handlers we should not do this (unless libc one day invents a scheme how to sanely install SIGBUS handlers for specific memory areas only). However, for now we can still make all our own tools robust. Note that external tools will only have read-access to the journal anyway, where SIGBUS is much more unlikely, given that only writes are subject to disk full problems.
2014-12-30tree-wide: spelling fixesVeres Lajos
https://github.com/vlajos/misspell_fixer https://github.com/torstehu/systemd/commit/b6fdeb618cf2f3ce1645b3315f15f482710c7ffa Thanks to Torstein Husebo <torstein@huseboe.net>.
2014-12-09treewide: sanitize loop_writeZbigniew Jędrzejewski-Szmek
loop_write() didn't follow the usual systemd rules and returned status partially in errno and required extensive checks from callers. Some of the callers dealt with this properly, but many did not, treating partial writes as successful. Simplify things by conforming to usual rules.
2014-12-09journalctl: respect --after-cursor semantics with --follow in all casesWesley Dawson
In the case where no entries have been added to the journal after the specified cursor, set need_seek before the main loop to prevent display of the entry at said cursor.
2014-11-28treewide: another round of simplificationsMichal Schmidt
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: more log_*_errno + return simplificationsMichal Schmidt
2014-11-28treewide: more log_*_errno() conversions, multiline callsMichal Schmidt
Basically: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \ $f; done Plus manual indentation fixups.
2014-11-28treewide: more log_*_errno() conversionsMichal Schmidt
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-11-27journalctl: print all possible lines immediately with --follow + --sinceAndrej Manduch
When I tryed to run journalctl with --follow and --since arguments it behaved very strangely. First It prints logs from what I specified in --since argument, then printed 10 lines (as is default in --follow) and when app put something new in to log journalctl printed everithing from the last printed line. How to reproduce: 1. run: journalctl -m --since 14:00 --follow Then you'll see 10 lines of logs since 14:00. After that wait until some app add something in the journal or just run `systemd-cat echo test` 2. After that journalctl will print every single line since 14:00 and will follow as expected. As long as --since and --follow will eventually print all relevant lines, I seen no reason why not to print them right away and not after first new message in journal. Relevant bugzillas: https://bugs.freedesktop.org/show_bug.cgi?id=71546 https://bugs.freedesktop.org/show_bug.cgi?id=64291
2014-11-03journalctl: add new --vacuum-size= and --vacuum-time= commands to clean up ↵Lennart Poettering
journal files based on a size/time limit This is equivalent to the effect of SystemMaxUse= and RetentionSec=, however can be invoked directly instead of implicitly.
2014-10-25journalctl: correct help text for --untilSantiago Vila
http://bugs.debian.org/766598
2014-10-24journalctl: Unify boot id lookup into common function get_bootsJan Janssen
2014-10-23journal: make sd_journal::files a OrderedHashmapMichal Schmidt
Anything that uses hashmap_next() almost certainly cares about the order and needs to be an OrderedHashmap.
2014-10-23journalctl: add new --flush command and make use of it in ↵Lennart Poettering
systemd-journal-flush.service This new command will ask the journal daemon to flush all log data stored in /run to /var, and wait for it to complete. This is useful, so that in case of Storage=persistent we can order systemd-tmpfiles-setup afterwards, to ensure any possibly newly created directory in /var/log gets proper access mode and owners.
2014-10-22journalctl: don't introduce numeric constants with special names, give them ↵Lennart Poettering
names
2014-10-09journalctl: use pager for --list-bootsZbigniew Jędrzejewski-Szmek
2014-10-09sd-journal: change check to assertZbigniew Jędrzejewski-Szmek
As of 0f99f74a14 'sd-journal: verify that object start with the field name' this condition should never happen.
2014-10-08time: functions named "internal" really shouldn't be exportedLennart Poettering
Also, let's try to make function names descriptive, instead of using bools for flags.
2014-10-03journalctl: make --utc work everywhereJan Synacek
The --utc option was introduced by commit 9fd290443f5f99fca0dcd4216b1de70f7d3b8db1. Howerver, the implementation was incomplete.
2014-10-02journalctl: add --utc optionJan Synacek
Introduce option to display time in UTC.
2014-09-29journalctl: do not output --reboot-- markers when running non-interactivelyZbigniew Jędrzejewski-Szmek
They are not legal in the export format.
2014-09-15hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt
It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
2014-08-31journalctl: Allow to disable line cap with --lines=allJan Janssen
2014-08-21journalctl: add "-t --identifier=STRING" optionHarald Hoyer
This turns journalctl to the counterpart of systemd-cat. Messages sent with systemd-cat --identifier foo --prioritiy debug can now be shown with journalctl --identifier foo --prioritiy debug "--identifier" is not merged with "--unit" to make a clear distinction between syslog and systemd units. syslog identifiers can be chosen freely by anyone.
2014-08-03Unify parse_argv styleZbigniew Jędrzejewski-Szmek
getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
2014-07-31Always prefer our headers to system headersZbigniew Jędrzejewski-Szmek
In practice this shouldn't make much difference, but sometimes our headers might be newer, and we want to test them.
2014-07-26Add utility function to append root to pathZbigniew Jędrzejewski-Szmek
2014-07-26Always check asprintf return codeKarel Zak
There is a small number of the places in sources where we don't check asprintf() return code and assume that after error the function returns NULL pointer via the first argument. That's wrong, after error the content of pointer is undefined.
2014-07-19journalctl,man: allow + only between termsZbigniew Jędrzejewski-Szmek
https://bugzilla.redhat.com/show_bug.cgi?id=1110712
2014-07-15journal-upload: use journal as the sourceZbigniew Jędrzejewski-Szmek
2014-04-05journalctl: free arg_file on exitZbigniew Jędrzejewski-Szmek
2014-03-18util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering
safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
2014-02-27journalctl: refuse extra arguments with --verify and similarZbigniew Jędrzejewski-Szmek
Positional arguments only make sense with the default action. For other actions, complain instead of ignoring them silently.
2014-02-19make gcc shut upLennart Poettering
If -flto is used then gcc will generate a lot more warnings than before, among them a number of use-without-initialization warnings. Most of them without are false positives, but let's make them go away, because it doesn't really matter.
2014-02-17doc: update punctuationJan Engelhardt
Resolve spotted issues related to missing or extraneous commas, dashes.
2014-01-28always use the same code for creating temporary filesLennart Poettering
Let's unify our code here, and also always specifiy O_CLOEXEC.
2014-01-11journalctl: allow globbing in --unit and --user-unitZbigniew Jędrzejewski-Szmek
This is a continuation of e3e0314b systemctl: allow globbing in commands which take multiple unit names. Multiple patterns can be specified, as separate arguments, or as one argument with patterns seperated by commas. If patterns are given, at least one unit must be matched (by any of the patterns). This is different behaviour than systemctl, but here it is necessary because otherwise anything would be matched, which is unlikely to be the intended behaviour. https://bugs.freedesktop.org/show_bug.cgi?id=59336
2013-12-26Use enums to make it obvious what boolean params meanZbigniew Jędrzejewski-Szmek
Suggested-by: Russ Allbery <rra@debian.org>
2013-12-26systemctl: allow globbing in commands which take multiple unit namesZbigniew Jędrzejewski-Szmek
2013-12-26journalctl: make sure -b --foobar cannot be misunderstood as --boot=--foobarLennart Poettering
2013-12-26Revert "journalctl: remove unexpected behavior of journalctl -b"Lennart Poettering
This reverts commit cf5bccc2bb9569030cb04debbc4208aaca0fe5b4. We should fix thinks properly if they aren't perfect, not just break other things...