Commit graph

119 commits

Author SHA1 Message Date
Lennart Poettering a24c64f03f journald: introduce new "systemd-journal" group and make it own the journal files
Previously all journal files were owned by "adm". In order to allow
specific users to read the journal files without granting it access to
the full "adm" powers, introduce a new specific group for this.

"systemd-journal" has to be created by the packaging scripts manually at
installation time. It's a good idea to assign a static UID/GID to this
group, since /var/log/journal might be shared across machines via NFS.

This commit also grants read access to the journal files by default to
members of the "wheel" and "adm" groups via file system ACLs, since
these "almost-root" groups should be able to see what's going on on the
system. These ACLs are created by "make install". Packagers probably
need to duplicate this logic in their postinst scripts.

This also adds documentation how to grant access to the journal to
additional users or groups via fs ACLs.
2013-03-05 18:59:03 +01:00
Daniel Wallace ffa7cd15cd journalctl: add --user-unit= switch
Add --user-unit= to make it possible to query for user logs by the name
of the service.
2013-03-01 14:39:04 +01:00
Lukas Nykryn d89d6c86d9 journalctl: add --reverse option to show the newest lines first 2013-03-01 12:51:24 +01:00
Zbigniew Jędrzejewski-Szmek 37d3ab1b7e Merge branch 'python-systemd-reader'
* python-systemd-reader:
  python-systemd: rename Journal to Reader
  build-sys: upload python documentation to freedesktop.org
  systemd-python: add Journal class for reading journal
  python: build html docs using sphinx
  journalct: also print Python code in --new-id
  python: utilize uuid.UUID in logging
  python: add systemd.id128 module
  ... and 34 other commits

In short: python module systemd.id128 is added, and existing
systemd.journal gains a new class systemd.journal.Reader, which can be
used to iterate over journal entries. Documentation is provided, and
accessible under e.g.
    pydoc3 systemd.journal.Reader
or
    firefox http://www.freedesktop.org/software/systemd/man/python-systemd/
2013-02-28 20:05:12 -05:00
Paul W. Frields 3ba09ee8eb journal: fix --until
https://bugs.freedesktop.org/show_bug.cgi?id=58946
2013-02-24 15:28:37 +01:00
Zbigniew Jędrzejewski-Szmek d489071fb3 journalct: also print Python code in --new-id 2013-02-22 16:57:43 +01:00
Lennart Poettering 96088db02b journalctl: allow both "-n 55" and "-n55" on the command line, as equivalent syntaxes
https://bugs.freedesktop.org/show_bug.cgi?id=60596
2013-02-12 00:31:13 +01:00
Zbigniew Jędrzejewski-Szmek 67e04a486b journalctl: allow --lines=0 i.e. only new
Makes it easier to watch just for new entries. Once scenario
is where the user starts 'journalctl -qfn0' to watch for changes
during some operation.
2013-01-28 22:38:55 -05:00
David Herrmann 244692cbfb journalctl: quit on I/O error
This makes journalctl quit on ferror() conditions on stdout. It fixes an
annoying bug if you pipe its output through 'less' and press 'q'. Without
this fix journalctl will continue reading all journal data until EOF which
can take quite some time. For instance on my machine:

    david-nb ~ # time journalctl | wc -l
    327240

    real    1m13.039s
    user    1m0.217s
    sys     0m10.467s

However, expected behavior is journalctl to quit when its pager closed the
output pipe.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-15 20:59:10 +01:00
Lennart Poettering bc2708414b build-sys: drop all distribution specfic checks
Yay, we now have a completely generic systemd. No distribution specific checks anymore!
2013-01-04 23:26:21 +01:00
Zbigniew Jędrzejewski-Szmek e3657ecd7f journalctl: add option to forgo ellipsization
Sometimes it is better to see messages in full, and the existing
set of options didn't allow this easily. E.g. now

  journalctl -f --full

will behave like

  tail -f /var/log/messages

of yore.

Long option only for now, since small letters are becoming
scarce, and this doesn't feel like a capital-letter-option.
'-u' would be nice, and the above command would be spelled

  journalctl -fu
2012-11-17 15:32:04 +01:00
Lennart Poettering 83f6936a01 journal: extend catalog header to 64bit for all fields, just to be safe and follow the rest of the file formats 2012-11-16 01:35:11 +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
Lekensteyn 71c0159692 journalctl: require argument for --priority
This fixes a segfault due to a missing value for --priority. -p is
unaffected because it is specified in the getopt_long parameter list.
2012-11-15 16:09:02 +01:00
Dave Reisner a9cdc94f7f enable localization for common *ctl commands 2012-11-12 14:16:07 -05:00
Michal Schmidt 0901758558 util: add is_locale_utf8()
journalctl and vconsole-setup both implement utf8 locale detection.
Let's have a common function for it.
The next patch will add another use.
2012-11-02 17:27:15 +01:00
Lennart Poettering db87a36e74 journalctl: remove left-over log message 2012-10-24 01:06:31 +02:00
Lennart Poettering ed757c0cb0 util: unify line caching and column caching 2012-10-19 00:07:55 +02:00
Lennart Poettering 8481248b9f util: unify usage of on_tty() in util.c 2012-10-19 00:07:55 +02:00
Lennart Poettering f89a3b6f5b journalctl: unify ellipsation handling between journalctl and systemctl 2012-10-18 23:35:44 +02:00
Lennart Poettering cd4b13e0bf journalctl: don't ellipsize unless on a tty 2012-10-18 23:35:44 +02:00
Lennart Poettering fd6e887537 journalctl: honour -n if -F is used 2012-10-18 23:35:44 +02:00
Lennart Poettering 15804cebfd journalctl: move access check before the first access to the journal files 2012-10-18 03:35:58 +02:00
Lennart Poettering 15119c1602 journalctl: implement quering field values with new -F switch
Example:

        journalctl -F _SYSTEMD_UNIT

will list all units that ever logged to the journal.
2012-10-18 03:35:58 +02:00
Lennart Poettering 3c1668da62 journal: add ability to list values a specified field can take in all entries of the journal
The new 'unique' API allows listing all unique field values that a field
specified by a field name can take in all entries of the journal. This
allows answering queries such as "What units logged to the journal?",
"What hosts have logged into the journal?", "Which boot IDs have logged
into the journal?".

Ultimately this allows implementation of tools similar to lastlog based
on journal data.

Note that listing these field values will not work for journal files
created with older journald, as the field values are not indexed in
older files.
2012-10-18 03:35:18 +02:00
Lennart Poettering c3f60ec54d journalctl: add --unit=/-u to match by unit name
This applies unit_name_mangle() to the specified unit names and hence
can handle weird characters nicely and will add unit suffixes as
necessary.
2012-10-16 02:59:27 +02:00
Lennart Poettering 9048b11f8b journalctl: harmonise in-stream comments
From now on, always use ANSI-SQL-style comments in log streams, i.e.
prefix with --. We also suffix things with this, just to be nice...
2012-10-16 01:09:09 +02:00
Zbigniew Jędrzejewski-Szmek edfb521a21 journalctl: skip informational messages in export/json modes 2012-10-15 18:17:49 +02:00
Zbigniew Jędrzejewski-Szmek c3eba2ab4e journalctl: make --follow really work 2012-10-14 15:29:38 +00:00
Zbigniew Jędrzejewski-Szmek e3ed66c52e journalctl: make --follow work again
Stopped working after cfbc22ab 'journalctl: implement --since= and
--until for filtering by time'.
2012-10-13 21:37:42 +02:00
Lennart Poettering cfbc22abd0 journalctl: implement --since= and --until for filtering by time 2012-10-11 16:43:37 +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 ad9eafab9f journalctl: properly parse --cursor= long getopt in addition to short -c 2012-10-10 01:35:24 +02:00
Lennart Poettering 7a69007a24 journal: implement follow mode for HTTP GET in gatewayd 2012-10-09 01:31:27 +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 8f14c8327b journalctl: add --cursor switch 2012-09-28 00:55:24 +02:00
Lennart Poettering 2a7b539a82 journald: always pass first entry timestamp back from journal_file_verify() 2012-09-24 15:02:43 +02:00
Mirco Tischler 73726ac898 journalctl: print correct timespan in verify
The old code used a timestamp to print a timespan for unsealed journalfiles,
incorrectly showing things like 2230 days of unsealed entries. Print the timespan
between the first and last entry instead.
2012-09-24 14:56:52 +02:00
Dave Reisner 585314e84c journalctl: reset cached column count on SIGWINCH
This requires a little bit of tip-toeing around to explicitly avoid
touching the environment from a sig handler. Instead, simply create a
function to reset the var to its "unset" state, allowing the next call
to columns() to recalculate and cache the new value.
2012-09-24 08:38:03 -04:00
Lennart Poettering 1705594f59 journalctl: make the argument to -n optional 2012-09-21 22:33:02 +02:00
Lennart Poettering cf5a343211 journalctl: print QR code only if we are running on an UTF-8 system 2012-09-12 09:23:38 +02:00
Lennart Poettering a1a03e3075 journal: add call to determine current journal file disk usage 2012-09-07 23:20:28 +02:00
Lennart Poettering cd931c0a46 journalctl: show "Reboot" markers in output only when showing local-only entries 2012-09-05 16:52:46 -07:00
Lennart Poettering 9e8a535faa journalctl: replace --local by --merge, i.e. don't interleave remote journals by default 2012-09-05 16:49:00 -07: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
Lennart Poettering 99add6fd0b journalctl: complain if unprivileged users attempt to access the journal and persistant logging is off 2012-08-22 04:45:17 +02:00
Lennart Poettering c0ca7aeec9 journalctl: be more friendly when informing about seal verification 2012-08-21 23:03:20 +02:00
Lennart Poettering cedb42bb69 journalctl: add a bit of color to the output 2012-08-21 15:53:48 +02:00
Lennart Poettering 89fef99014 journal: automatically evolve FSS key even when nothing is logged 2012-08-21 01:29:17 +02:00
Lennart Poettering c05276f23e journalctl: reword things a bit 2012-08-21 01:02:08 +02:00