summaryrefslogtreecommitdiff
path: root/src/journal/journalctl.c
AgeCommit message (Collapse)Author
2013-05-14journalctl: add -k/--dmesgZbigniew Jędrzejewski-Szmek
2013-05-07hostname: only suppress setting of pretty hostname if it is non-equal to the ↵Lennart Poettering
static hostname and if the static hostname is set, too https://bugzilla.redhat.com/show_bug.cgi?id=957814
2013-04-18move _cleanup_ attribute in front of the typeHarald Hoyer
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-17journalctl: specify "--unit=" and "--user-unit" multiple timesHarald Hoyer
Previously only one "--unit=" or "--user-unit" could be specified. With this patch, journalcrtl can show multiple units. $ journalctl -u systemd-udevd.service -u sshd.service -u crond.service -b -- Logs begin at Sa 2013-03-23 11:08:45 CET, end at Fr 2013-04-12 09:10:22 CEST. -- Apr 12 08:41:37 lenovo systemd[1]: Started udev Kernel Device Manager. Apr 12 08:41:37 lenovo systemd[1]: Stopped udev Kernel Device Manager. Apr 12 08:41:38 lenovo systemd[1]: Started udev Kernel Device Manager. Apr 12 08:41:38 lenovo crond[291]: (CRON) INFO (Syslog will be used instead of sendmail.) Apr 12 08:41:38 lenovo crond[291]: (CRON) INFO (running with inotify support) Apr 12 08:41:39 lenovo systemd[1]: Starting OpenSSH server daemon... Apr 12 08:41:39 lenovo systemd[1]: Started OpenSSH server daemon. Apr 12 08:41:39 lenovo sshd[355]: Server listening on 0.0.0.0 port 22. Apr 12 08:41:39 lenovo sshd[355]: Server listening on :: port 22. Apr 12 08:41:39 lenovo mtp-probe[373]: checking bus 1, device 8: "/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5.6/1-1.5.6.2/1-1.5.6.2.1"
2013-04-17journal: add one more level on top with ANDHarald Hoyer
When using "-p" and "-b" in combination with "-u", the output is not what you would expect. The reason is the sd_journal_add_disjunction() call in add_matches_for_unit() and add_matches_for_user_unit(), which adds two ORs without taking the other conditions to every OR. Adding another level on top with AND and sd_journal_add_conjunction() solves the problem. Output before: $ journalctl -o short-monotonic -ab -p 0 -u sshd.service -- Reboot -- [ 3.216305] lenovo systemd[1]: Starting OpenSSH server daemon... -- Reboot -- [ 3.168666] lenovo systemd[1]: Starting OpenSSH server daemon... [ 3.169639] lenovo systemd[1]: Started OpenSSH server daemon. [36285.635389] lenovo systemd[1]: Stopped OpenSSH server daemon. -- Reboot -- [ 10.838657] lenovo systemd[1]: Starting OpenSSH server daemon... [ 10.913698] lenovo systemd[1]: Started OpenSSH server daemon. [ 6881.035183] lenovo systemd[1]: Stopped OpenSSH server daemon. -- Reboot -- [ 6.636228] lenovo systemd[1]: Starting OpenSSH server daemon... [ 6.662573] lenovo systemd[1]: Started OpenSSH server daemon. [ 6.681148] lenovo sshd[397]: Server listening on 0.0.0.0 port 22. [ 6.681379] lenovo sshd[397]: Server listening on :: port 22. As we see, the output is from _every_ boot and priority 0 is not taken into account. Output after patch: $ journalctl -o short-monotonic -ab -p 0 -u sshd.service -- Logs begin at Sun 2013-02-24 20:54:44 CET, end at Tue 2013-03-19 14:58:21 CET. -- Increasing the priority: $ journalctl -o short-monotonic -ab -p 6 -u sshd.service -- Logs begin at Sun 2013-02-24 20:54:44 CET, end at Tue 2013-03-19 14:59:12 CET. -- [ 6.636228] lenovo systemd[1]: Starting OpenSSH server daemon... [ 6.662573] lenovo systemd[1]: Started OpenSSH server daemon. [ 6.681148] lenovo sshd[397]: Server listening on 0.0.0.0 port 22. [ 6.681379] lenovo sshd[397]: Server listening on :: port 22.
2013-04-17journalctl: show fields requested with --field in fullZbigniew Jędrzejewski-Szmek
I see little point in silently truncating fields when they are explictly requested. With this change e.g. journalctl -b MESSAGE_ID=9f26aa562cf440c2b16c773d0479b518 --field=BOOTCHART works as expected.
2013-04-10journalctl: check return of strjoinLukas Nykryn
2013-04-04journal: add public API call sd_journal_get_events()Lennart Poettering
This function should be used when filling in "struct pollfd"'s .events field for watching the journal. It will always return POLLIN for now, but we should keep our options open to change this later on. This mimics libsystemd-bus' sd_bus_get_events() call with the same purpose.
2013-04-04util: make time formatting a bit smarterLennart Poettering
Instead of outputting "5h 55s 50ms 3us" we'll now output "5h 55.050003s". Also, while outputting the accuracy is configurable. Basically we now try use "dot notation" for all time values > 1min. For >= 1s we use 's' as unit, otherwise for >= 1ms we use 'ms' as unit, and finally 'us'. This should give reasonably values in most cases.
2013-04-03util: rename parse_usec() to parse_sec() sinds the default unit is secondsLennart Poettering
Internally we store all time values in usec_t, however parse_usec() actually was used mostly to parse values in seconds (unless explicit units were specified to define a different unit). Hence, be clear about this and name the function about what we pass into it, not what we get out of it.
2013-03-31journalctl: reword error messageZbigniew Jędrzejewski-Szmek
Sentence seemed to suggest that all three conditions must be true.
2013-03-29journalctl: fix --update-catalog with not --root argZbigniew Jędrzejewski-Szmek
grawity> `journalctl --update-catalog` from latest git prints: "Recursive mkdir .: Invalid argument" and "Failed to write : Invalid argument"
2013-03-28journalctl: support --root for message catalogsZbigniew Jędrzejewski-Szmek
2013-03-28catalog: open up catalog internalsZbigniew Jędrzejewski-Szmek
In order to write tests for the catalog functions, they are made non-static and start taking a 'database' parameter, which is the name of a file with the preprocessed catalog entries. This makes it possible to make test-catalog part of the normal test suite, since it now only operates on files in /tmp. Some more tests are added.
2013-03-23journalctl: various fixes to the access check logicLennart Poettering
- Reword messages a bit - Correct check whether EACCES is in the set of errors - Don't complain if no journal files are found - allocate Set object for errors lazily since in the best case we don't need it at all. - don't consider it an error if /run/log/journal doesn't exist (because that's the usual case actually, if storage is enabled)
2013-03-22journalctl: be smarter about journal error checksZbigniew Jędrzejewski-Szmek
There are many ways in which we can get those checks wrong, so it is better to warn and then error out on a real access failure. The error messages are wrapped to <80 lines, because their primary use is to be displayed in the terminal, and it is easier to read them this way. Reading them in the journal can be a bit trickier, but this is a bug in logs-show.c.
2013-03-22build-sys: move acl searching code into libsystemd-aclZbigniew Jędrzejewski-Szmek
This loop over acls is a bit too much to keep inside of another loop.
2013-03-22journalctl: give a nice hint about group membership based on ACLs of ↵Lennart Poettering
/var/log/journal If we notice that we unprivileged and not in any of the groups which have access to /var/log/journal, print a nice message about which groups do. This checks and prints all groups that are in the default ACL for /var/log/journal, which is not necessarily correct for all journal files, but pretty close.
2013-03-20Remove some unused variablesZbigniew Jędrzejewski-Szmek
2013-03-19journalct: beef up entry listingZbigniew Jędrzejewski-Szmek
The ability to dump catalog entries in full and by id is added.
2013-03-19journalctl: use _cleanup_ in one functionZbigniew Jędrzejewski-Szmek
2013-03-18journal,shared: add _cleanup_journal_close_Zbigniew Jędrzejewski-Szmek
2013-03-13journalctl: show systemd messages about unit for -uZbigniew Jędrzejewski-Szmek
journalctl -u unit is not very useful, because it doesn't show systemd messages about starting, stopping, coredumps, etc, like systemctl status unit does. Make it show the same information using the same rules. If somebody really want to see just messages from by the unit, it is easy enough to use _SYSTEMD_UNIT=...
2013-03-07journalctl: imply -n1000 when -e is usedLennart Poettering
Make sure the pager does not have to buffer an unbounded number of log messages, by default.
2013-03-07pager: introduce "jump to end" optionHarald Hoyer
$ journalctl -be is what you want :) https://bugzilla.redhat.com/show_bug.cgi?id=867841
2013-03-07libsystemd-journal: return 0 on success in get_data()Zbigniew Jędrzejewski-Szmek
The man page says so. Right now 0 would be returned if the data was encrypted, 1 otherwise.
2013-03-05journald: introduce new "systemd-journal" group and make it own the journal ↵Lennart Poettering
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-01journalctl: add --user-unit= switchDaniel Wallace
Add --user-unit= to make it possible to query for user logs by the name of the service.
2013-03-01journalctl: add --reverse option to show the newest lines firstLukas Nykryn
2013-02-28Merge branch 'python-systemd-reader'Zbigniew Jędrzejewski-Szmek
* 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-24journal: fix --untilPaul W. Frields
https://bugs.freedesktop.org/show_bug.cgi?id=58946
2013-02-22journalct: also print Python code in --new-idZbigniew Jędrzejewski-Szmek
2013-02-12journalctl: allow both "-n 55" and "-n55" on the command line, as equivalent ↵Lennart Poettering
syntaxes https://bugs.freedesktop.org/show_bug.cgi?id=60596
2013-01-28journalctl: allow --lines=0 i.e. only newZbigniew Jędrzejewski-Szmek
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-15journalctl: quit on I/O errorDavid Herrmann
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-04build-sys: drop all distribution specfic checksLennart Poettering
Yay, we now have a completely generic systemd. No distribution specific checks anymore!
2012-11-17journalctl: add option to forgo ellipsizationZbigniew Jędrzejewski-Szmek
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-16journal: extend catalog header to 64bit for all fields, just to be safe and ↵Lennart Poettering
follow the rest of the file formats
2012-11-15journal: implement message catalogLennart Poettering
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-15journalctl: require argument for --priorityLekensteyn
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-12enable localization for common *ctl commandsDave Reisner
2012-11-02util: add is_locale_utf8()Michal Schmidt
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-10-24journalctl: remove left-over log messageLennart Poettering
2012-10-19util: unify line caching and column cachingLennart Poettering
2012-10-19util: unify usage of on_tty() in util.cLennart Poettering
2012-10-18journalctl: unify ellipsation handling between journalctl and systemctlLennart Poettering
2012-10-18journalctl: don't ellipsize unless on a ttyLennart Poettering
2012-10-18journalctl: honour -n if -F is usedLennart Poettering
2012-10-18journalctl: move access check before the first access to the journal filesLennart Poettering
2012-10-18journalctl: implement quering field values with new -F switchLennart Poettering
Example: journalctl -F _SYSTEMD_UNIT will list all units that ever logged to the journal.