Commit graph

191 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 8c1396b1c2 journalctl: show lines in full with --all
In 31f7bf1 "logs-show: print multiline messages", I forgot
to take into account the fact that --all implies --full for
journalctl.
2013-06-20 16:15:04 -04:00
Zbigniew Jędrzejewski-Szmek a688baa8b7 journal: add ability to filter by current user
This is the just the library part.

SD_JOURNAL_CURRENT_USER flags is added to sd_j_open(), to open
files from current user.

SD_JOURNAL_SYSTEM_ONLY is renamed to SD_JOURNAL_SYSTEM,
and changed to mean to (also) open system files. This way various
flags can be combined, which gives them nicer semantics, especially
if other ones are added later.

Backwards compatibility is kept, because SD_JOURNAL_SYSTEM_ONLY
is equivalent to SD_JOURNAL_SYSTEM if used alone, and before there
we no other flags.
2013-06-10 10:10:06 -04:00
Zbigniew Jędrzejewski-Szmek a72b63536f journalctl: fix verbose output when no logs are found
$ journalctl -o verbose _EXE=/quiet/binary -f
-- Logs begin at Sun 2013-03-17 17:28:22 EDT. --
Failed to get realtime timestamp: Cannot assign requested address

JOURNAL_FOREACH_DATA_RETVAL is added, which allows the caller
to get the return value from sd_journal_enumerate_data. I think
we might want to expose this macro like SD_JOURNAL_FOREACH_DATA,
but for now it is in journal-internal.h.

There's a change in behaviour for output_*, not only in
output_verbose, that errors in sd_j_enumerate_data are not silently
ignored anymore.

https://bugs.freedesktop.org/show_bug.cgi?id=56459
2013-06-09 22:38:29 -04:00
Zbigniew Jędrzejewski-Szmek 31f7bf1994 logs-show: print multiline messages
[    0.019862] fedora kernel: CPU0: Thermal monitoring enabled (TM1)
[    0.019900] fedora kernel: Last level iTLB entries: 4KB 512, 2MB 0, 4MB 0
                              Last level dTLB entries: 4KB 512, 2MB 32, 4MB 32
                              tlb_flushall_shift: 5
[    0.020118] fedora kernel: Freeing SMP alternatives: 24k freed
2013-06-09 13:49:38 -04:00
Zbigniew Jędrzejewski-Szmek 5ec7641776 systemctl: limit logs in status to current boot
Also reworded a few debug messages for brevity, and added a log
statement which prints out the filter at debug level:

Journal filter: (((UNIT=sys-module-configfs.device AND _PID=1) OR (COREDUMP_UNIT=sys-module-configfs.device AND MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1) OR _SYSTEMD_UNIT=sys-module-configfs.device) AND _BOOT_ID=4e3c518ab0474c12ac8de7896fe6b154)
2013-06-04 09:59:06 -04:00
Harald Hoyer 7fd1b19bc9 move _cleanup_ attribute in front of the type
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-18 09:11:22 +02:00
Lennart Poettering dfb33a9737 macro: rework how we define cleanup macros
There's now a generic _cleanup_ macro with an argument. The macros for
specific types are now defined using this macro, and in the header files
where they belong.

All cleanup handlers are now inline functions.
2013-04-16 05:25:57 +02:00
Zbigniew Jędrzejewski-Szmek 763c7aa288 journal,shared: add _cleanup_journal_close_ 2013-03-18 19:49:30 -04:00
Zbigniew Jędrzejewski-Szmek 886a64fe69 logs-show: export logic to add matches for units
After that functions which add matches, show_journal_by_unit
and show_journal_by_user_unit, become nearly identical, so
I merged them into one function.
2013-03-13 19:53:29 -04:00
Mirco Tischler a4b88c1ecb logs-show: show messages for all unit types in systemctl status
I can't find a reason why we shouldn't try to output messages for other
unit types than .service, .socket, .mount and .swap as well. It's probably
a leftover from before we started logging UNIT= from inside PID 1.
2013-02-07 01:02:34 -05:00
Mirco Tischler f904546894 journal: log user units for coredumps and show them in systemctl status 2013-02-07 01:02:34 -05:00
Mirco Tischler 1a6c43e946 logs-show: add show_journal_by_user_unit
Print the journal for a user session unit. For now this filters by
_SYSTEMD_USER_UNIT and USER_UNIT and additionally _UID.
2013-01-18 11:14:00 -05:00
Zbigniew Jędrzejewski-Szmek 2e72983463 logs-show: automatic cleanup 2013-01-16 12:10:03 -05:00
Lennart Poettering e8bc0ea2b1 journalctl: strip TABs and ANSI color sequences from log messages when displaying them 2012-12-23 11:28:14 +01:00
Lennart Poettering 93b73b064c journal: by default do not decompress dat objects larger than 64K
This introduces a new data threshold setting for sd_journal objects
which controls the maximum size of objects to decompress. This is
relieves the library from having to decompress full data objects even
if a client program is only interested in the initial part of them.

This speeds up "systemd-coredumpctl" drastically when invoked without
parameters.
2012-11-21 00:28:00 +01:00
Lennart Poettering d4205751d4 journal: implement message catalog
The message catalog can be used to attach short help texts to log lines,
keyed by their MESSAGE_ID= fields. This is useful to help the
administrator understand the context and cause of a message, find
possible solutions and find further related documentation.

Since this is keyed off MESSAGE_ID= this will only work for native
journal messages.

The message catalog supports i18n, and is useful to augment english
language system messages with explanations in the local language.

This commit only includes short explanatory messages for a few example
message IDs, we'll add more complete documentation for the relevant
systemd messages later on.
2012-11-15 23:09:07 +01:00
Lennart Poettering d99ae53a73 journal: properly serialize fields with multiple values into JSON
This now matches the JSON serialization spec from:

http://www.freedesktop.org/wiki/Software/systemd/json
2012-10-25 01:24:44 +02:00
Lennart Poettering cd4b13e0bf journalctl: don't ellipsize unless on a tty 2012-10-18 23:35:44 +02:00
Lennart Poettering 240a5fe83e journal: add ability to list unique fields to gatewayd 2012-10-18 22:34:42 +02:00
Lennart Poettering 48383c2511 journal: support epxorting the journal in a format suitable for text/event-stream 2012-10-11 02:37:10 +02:00
Lennart Poettering 08ace05beb logs-show: various cleanups
Among other cleanups this introduces a threshold for the size of binary
blobs we serialize as integer arrays in the JSON output. THis can be
disabled via --all.
2012-09-28 00:55:24 +02:00
Lennart Poettering c198300fc4 journalctl: don't choke on entries with no MESSAGE= field
https://bugs.freedesktop.org/show_bug.cgi?id=50177
2012-09-18 11:12:31 +02:00
Lennart Poettering a6e87e90ed journalctl: rework JSON output mode
This splits the JSON output mode into different modes: json and
json-pretty. The former printing one entry per line, the latter showing
JSON objects nicely indented and in multiple lines to make it easier to
read for humans.
2012-09-05 15:25:32 -07:00
Brandon Philips e268b81e97 shared: logs-show: fflush after each output type
journalctl -f redirected to a pipe or file wasn't working for some
output formats but was working for json. It turns out only json was
doing an fflush.

Make all output formats flush.
2012-09-03 19:16:20 -07:00
Lennart Poettering 1946b0bd55 journalctl: include logs from PID 1 about services in systemctl status 2012-09-03 18:59:05 -07:00
Lennart Poettering 64825d3c58 fix a couple of issues found with llvm-analyze 2012-08-08 23:54:21 +02:00
Shawn Landen 193556b69e logs-show: fix off-by-one error
Ellipsize lines that are one character too long.
2012-08-03 18:12:07 +02:00
Lennart Poettering 498261871d journalctl: hightlight log lines by priority
warn/notice = bright white
< error = red
2012-07-26 16:56:21 +02:00
Lennart Poettering 46b0d92225 logs-show: fix OOM path 2012-07-26 16:56:21 +02:00
Shawn Landden 0d0f0c50d3 log.h: new log_oom() -> int -ENOMEM, use it
also a number of minor fixups and bug fixes: spelling, oom errors
that didn't print errors, not properly forwarding error codes,
few more consistency issues, et cetera
2012-07-26 11:48:26 +02:00
Shawn Landden 669241a076 use "Out of memory." consistantly (or with "\n")
glibc/glib both use "out of memory" consistantly so maybe we should
consider that instead of this.

Eliminates one string out of a number of binaries. Also fixes extra newline
in udev/scsi_id
2012-07-25 11:23:57 +02:00
Eelco Dolstra b61a4660fc journalctl: fix assertion failure in ellipsize_mem()
When showing the journal through "journalctl --no-pager", if the
prefix of the log message (i.e. the date and syslog identifier) is
less than 3 characters shorter than the width of the terminal, you
get:

Assertion 'new_length >= 3' failed at src/shared/util.c:3859, function ellipsize_mem(). Aborting.

because there is not enough space for the "...".  This patch add the
necessary check.
2012-07-20 00:12:30 +02:00
Zbigniew Jędrzejewski-Szmek 92a1fd9e95 journalctl: do not ellipsize when using pager
If a pager is used, ellipsization is redundant — the pager does
that better by hiding the part that cannot be shown. Pager's advantage
is that the user can press → to view the hidden part of a message,
and then ← to return.
2012-07-17 17:20:58 +02:00
Zbigniew Jędrzejewski-Szmek 085d71209b logs: Adapt interface in log-show.c (show_journal_by_unit)
Convert more flag arguments into one flag variable.
2012-07-17 17:20:58 +02:00
Zbigniew Jędrzejewski-Szmek 25277cd7fb logs: Adapt interface in log-show.c (output_journal)
In preparation for adding more output switches, convert a series of
flags arguments into one flag variable.
2012-07-17 17:20:57 +02:00
Lennart Poettering b59866aefa man: document sd_journal_get_cutoff_realtime_usec() 2012-07-13 20:17:37 +02:00
Zbigniew Jędrzejewski-Szmek ba961854dd journalctl: show any printable Unicode character
This makes sure we are OK in outputting all valid, non-control UTF-8
characters, instead of just printable 7bit ASCII.
2012-07-13 01:07:41 +02:00
Lennart Poettering e02d1cf72d journal: introduce sd_journal_wait() to simplify writing synchronous clients 2012-07-10 21:46:11 +02:00
Lennart Poettering 089842938d journal: expose and make use of cutoff times of journal
This helps explaining when the log output of "systemctl status" is
incomplete because the logs got rotated since the service was started.
2012-06-17 00:03:12 +02:00
Lennart Poettering 7ea07dcdda fix a couple of things found with the llvm static analyzer 2012-04-13 13:58:50 +02:00
Kay Sievers f33d3ec1d7 move more common files to shared/ and add them to shared.la 2012-04-12 02:39:37 +02:00
Renamed from src/logs-show.c (Browse further)