summaryrefslogtreecommitdiff
path: root/src/journal/journalctl.c
AgeCommit message (Collapse)Author
2015-11-05treewide: use the negative error codes returned by our functionsMichal Schmidt
Our functions return negative error codes. Do not rely on errno being set after calling our own functions.
2015-11-03journalctl: when we fail to open a journal file, print whyLennart Poettering
When we enumerate journal files and encounter an invalid one, remember which this, and show it to the user. Note the possibly slightly surprising logic here: we store only one path per error code. This means we show all error kinds but not every actual error we encounter. This has the benefit of not requiring us to keep a potentially unbounded list of errors with their sources around, but can still provide a pretty complete overview on the errors we encountered. Fixes #1669.
2015-11-03journalctl: continue operation, even if we run into an invalid fileLennart Poettering
2015-10-27util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering
2015-10-27util-lib: split out globbing related calls into glob-util.[ch]Lennart Poettering
2015-10-27util-lib: split out syslog-related calls into syslog-util.[ch]Lennart Poettering
2015-10-27util-lib: move more locale-related calls to locale-util.[ch]Lennart Poettering
2015-10-27util-lib: move a number of fs operations into fs-util.[ch]Lennart Poettering
2015-10-27util-lib: split out file attribute calls to chattr-util.[ch]Lennart Poettering
2015-10-27util-lib: split out resource limits related calls into rlimit-util.[ch]Lennart Poettering
2015-10-27util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]Lennart Poettering
2015-10-26util-lib: split out user/group/uid/gid calls into user-util.[ch]Lennart Poettering
2015-10-26util-lib: split out IO related calls to io-util.[ch]Lennart Poettering
2015-10-25util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering
There are more than enough to deserve their own .c file, hence move them over.
2015-10-24path-util: unify how we process paths specified on the command lineLennart Poettering
Let's introduce a common function that makes relative paths absolute and warns about any errors while doing so.
2015-10-22journalctl: clarify -q optionEvgeny Vereshchagin
-q suppresses info messages too
2015-10-13Merge pull request #1548 from evverx/journalctl-catalog-ops-fixesLennart Poettering
Fix journalctl --dump-catalog, journalctl --list-catalog
2015-10-13journalctl: introduce short options for --since and --untilJan Synacek
Fixes #1514.
2015-10-13journalctl: enable args for --dump-catalog and --list-catalogEvgeny Vereshchagin
`journalctl --dump-catalog ID1 ID2 ...` works fine.
2015-10-13journalctl: open pager for --dump-catalog and --list-catalogEvgeny Vereshchagin
2015-10-02journal: rework vacuuming logicLennart Poettering
Implement a maximum limit on number of journal files to keep around. Enforcing a limit is useful on this since our performance when viewing pays a heavy penalty for each journal file to interleve. This setting is turned on now by default, and set to 100. Also, actully implement what 348ced909724a1331b85d57aede80a102a00e428 promised: use whatever we find on disk at startup as lower bound on how much disk space we can use. That commit introduced some provisions to implement this, but actually never did. This also adds "journalctl --vacuum-files=" to vacuum files on disk by their number explicitly.
2015-10-01Merge pull request #1426 from poettering/log-syntaxDaniel Mack
logging fixes and more
2015-09-30tree-wide: remove a number of invocations of strerror() and replace by %mLennart Poettering
Let's clean up our tree a bit, and reduce invocations of the thread-unsafe strerror() by replacing it with printf()'s %m specifier.
2015-09-30journalctl: add --rotate optionEvgeny Vereshchagin
shortcut for `systemctl kill --kill-who main --signal SIGUSR2 systemd-journald`
2015-09-29bus-util: rename bus_open_transport() to bus_connect_transport()Lennart Poettering
In sd-bus, the sd_bus_open_xyz() family of calls allocates a new bus, while sd_bus_default_xyz() family tries to reuse the thread's default bus. bus_open_transport() sometimes internally uses the former, sometimes the latter family, but suggests it only calls the former via its name. Hence, let's avoid this confusion, and generically rename the call to bus_connect_transport(). Similar for all related calls. And while we are at it, also change cgls + cgtop to do direct systemd connections where possible, since all they do is talk to systemd itself.
2015-09-29util: introduce common version() implementation and use it everywhereLennart Poettering
This also allows us to drop build.h from a ton of files, hence do so. Since we touched the #includes of those files, let's order them properly according to CODING_STYLE.
2015-09-22cgtop: underline table headerLennart Poettering
Let's underline the header line of the table shown by cgtop, how it is customary for tables. In order to do this, let's introduce new ANSI underline macros, and clean up the existing ones as side effect.
2015-09-10tree-wide: never use the off_t unless glibc makes us use itLennart Poettering
off_t is a really weird type as it is usually 64bit these days (at least in sane programs), but could theoretically be 32bit. We don't support off_t as 32bit builds though, but still constantly deal with safely converting from off_t to other types and back for no point. Hence, never use the type anymore. Always use uint64_t instead. This has various benefits, including that we can expose these values directly as D-Bus properties, and also that the values parse the same in all cases.
2015-09-09tree-wide: make use of log_error_errno() return value in more casesLennart Poettering
The previous coccinelle semantic patch that improved usage of log_error_errno()'s return value, only looked for log_error_errno() invocations with a single parameter after the error parameter. Update the patch to handle arbitrary numbers of additional arguments.
2015-09-09tree-wide: make use of log_error_errno() return valueLennart Poettering
Turns this: r = -errno; log_error_errno(errno, "foo"); into this: r = log_error_errno(errno, "foo"); and this: r = log_error_errno(errno, "foo"); return r; into this: return log_error_errno(errno, "foo");
2015-08-17journalctl: make sure 'journalctl -f -t unmatched' blocksStef Walter
Previously the following command: $ journalctl -f -t unmatchedtag12345 ... would block when called with criteria that did not match any journal lines. Once log lines appeared that matched the criteria they were displayed. Commit 02ab86c732576a71179ce12e97d44c289833236d broke this behavior and the journal was not followed, but the command exits with '-- No entries --' displayed. This commit fixes the issue. More information downstream: https://bugzilla.redhat.com/show_bug.cgi?id=1253649
2015-08-05Merge branch 'hostnamectl-dot-v2'Zbigniew Jędrzejewski-Szmek
Manual merge of https://github.com/systemd/systemd/pull/751.
2015-08-05hostname-util: get rid of unused parameter of hostname_cleanup()Zbigniew Jędrzejewski-Szmek
All users are now setting lowercase=false.
2015-07-31tree-wide: introduce mfree()David Herrmann
Pretty trivial helper which wraps free() but returns NULL, so we can simplify this: free(foobar); foobar = NULL; to this: foobar = mfree(foobar);
2015-07-24journalctl: properly detect empty journal filesLennart Poettering
When we encounter a journal file with exactly zero entries, print a nice message and exit, and don't print a weird error message.
2015-07-03sd-bus: introduce new sd_bus_flush_close_unref() callLennart Poettering
sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush() (which writes all unwritten messages out) + sd_bus_close() (which terminates the connection, releasing all unread messages) + sd_bus_unref() (which frees the connection). The combination of this call is used pretty frequently in systemd tools right before exiting, and should also be relevant for most external clients, and is hence useful to cover in a call of its own. Previously the combination of the three calls was already done in the _cleanup_bus_close_unref_ macro, but this was only available internally. Also see #327
2015-05-19journalctl: unify how we free boot id lists a bitLennart Poettering
Instead of use LIST_FOREACH_SAFE, just use the same, seperate destructor everywhere.
2015-05-19journalctl: clean up how we log errorsLennart Poettering
All functions should either log the errors they run into, or only return them in which case the caller should log them. Make sure this rule is followed, so that each error is logged precisely once, and neither never, nor more than once.
2015-05-19journalctl: rename boot_id_t to BootIdLennart Poettering
So far we tried to reserve the _t suffix to types we use like a value in contrast to types we use as objects, hence let's do this in journalctl too.
2015-05-19journalctl: lstat() should suffice if we call canonicalize_file_name() firstLennart Poettering
2015-05-19journalctl: free all command line argument objectsLennart Poettering
let's try to be valgrind clean
2015-05-19journalctl: only have a single exit path from main()Lennart Poettering
That way we can be sure we execute the destructors properly, and can be valgrind-clean.
2015-05-19journalctl: Improve boot ID lookupJan Janssen
This method should greatly improve offset based lookup, by simply jumping from one boot to the next boot. It starts at the journal head to get the a boot ID, makes a _BOOT_ID match and then comes from the opposite journal direction (tail) to get to the end that boot. After flushing the matches and advancing the journal from that exact position, we arrive at the start of next boot. Rinse and repeat. This is faster than the old method of aggregating the full boot listing just so we can jump to a specific boot, which can be a real pain on big journals just for a mere "-b -1" case. As an additional benefit --list-boots should improve slightly too, because it does less seeking. Note that there can be a change in boot order with this lookup method because it will use the order of boots in the journal, not the realtime stamp stored in them. That's arguably better, though. Another deficiency is that it will get confused with boots interleaving in the journal, therefore, it will refuse operation in --merge, --file and --directory mode. https://bugs.freedesktop.org/show_bug.cgi?id=72601
2015-05-18util: split all hostname related calls into hostname-util.cLennart Poettering
2015-05-05core: rework unit name validation and manipulation logicLennart Poettering
A variety of changes: - Make sure all our calls distuingish OOM from other errors if OOM is not the only error possible. - Be much stricter when parsing escaped paths, do not accept trailing or leading escaped slashes. - Change unit validation to take a bit mask for allowing plain names, instance names or template names or an combination thereof. - Refuse manipulating invalid unit name
2015-04-22journalctl: rework code that checks whether we have access to /var/log/journalLennart Poettering
- fix some memory leaks on error conditions - handle all error cases properly, and log about failures - move HAVE_ACL and no-HAVE_ACL code closer to each other
2015-04-11shared: add terminal-util.[ch]Ronny Chevalier
2015-04-08util: merge change_attr_fd() and chattr_fd()Lennart Poettering
2015-03-27fix gcc warnings about uninitialized variablesHarald Hoyer
like: src/shared/install.c: In function ‘unit_file_lookup_state’: src/shared/install.c:1861:16: warning: ‘r’ may be used uninitialized in this function [-Wmaybe-uninitialized] return r < 0 ? r : state; ^ src/shared/install.c:1796:13: note: ‘r’ was declared here int r; ^
2015-03-13tree-wide: there is no ENOTSUP on linuxDavid Herrmann
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.