Bug 1182661 - RFE: journalctl should allow simpler --since/--until specification, extend documentation
Summary: RFE: journalctl should allow simpler --since/--until specification, extend do...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jan Synacek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-15 16:28 UTC by Karel Volný
Modified: 2015-12-17 07:24 UTC (History)
9 users (show)

Fixed In Version: systemd-222-10.fc23
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-17 07:24:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karel Volný 2015-01-15 16:28:21 UTC
Description of problem:
I need to check logs since beginning of a test. The current '--since' syntax makes it overcomplicated, I'd appreciate if unformatted time could be accepted.
Also, the documentation of the current syntax lacks a bit.

Version-Release number of selected component (if applicable):
systemd-216-14.fc21.x86_64

How reproducible:
always

now I have to do something like this:
1. START=`date +'%Y-%m-%d %H:%M:%S'`
2. do your stuff
3. journalctl --since "$START"

which is a pain when it comes to quoting and encapsulating the commands when fed to functions etc. because of the space character

in addition, if your timezone changes in step 2, you'll get nonsense and to workaround, you have to do

1. START=`date --utc +'%Y-%m-%d %H:%M:%S'`
2. do your stuff
3. journalctl --utc --since "$START"

but that's a mess when you want to read it in your local zone, you have to recalculate timestamps in your head, as '--utc' changes not just the expectations about the dates on commandline but it changes the output too

In my usecase, it would be much simpler to have a possibility to do:

1. START=`date +%s`
2. do your stuff
3. journalctl --since $START

- "%s" is just integer, no need for quoting, no need to account for time zones ...


And while at it, the relative syntax with "+" or "-" should also accept just a number of seconds; but note that the current description in the manpage doesn't specify _any_ syntax if +/- is used.

Comment 1 Lennart Poettering 2015-02-04 19:47:58 UTC
You can already do "journalctl --since @4711" to refer to Unix time 4711 (seconds past 1970, jan)...

That is not documented currently, though, but we really should...

Comment 2 Lennart Poettering 2015-02-04 19:50:03 UTC
Oh, wait, it actually *is* documented. Quoting systemd.time(7):

   ... Finally, a timespan prefixed with "@" is evaluated relative to the UNIX time epoch 1st Jan, 1970, 00:00 ...

Do you need more than that?

Comment 3 Karel Volný 2015-02-05 10:06:44 UTC
uh, okay, so if journalctl --since/--until accepts full range of possibilities documented in systemd.time then I guess it would be better to just refer to it

in the current form, when the journalctl manpage describes only some subset, I got under the impression that only this subset is supported ...

Comment 4 Fedora End Of Life 2015-11-04 13:47:02 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Karel Volný 2015-11-06 13:47:37 UTC
systemd-222-8.fc23.x86_64
man journalctl

...
       --since=, --until=
           Start showing entries on or newer than the specified date, or on or
           older than the specified date, respectively. Date specifications
           should be of the format "2012-10-30 18:17:16". If the time part is
           omitted, "00:00:00" is assumed. If only the seconds component is
           omitted, ":00" is assumed. If the date component is omitted, the
           current day is assumed. Alternatively the strings "yesterday",
           "today", "tomorrow" are understood, which refer to 00:00:00 of the day
           before the current day, the current day, or the day after the current
           day, respectively.  "now" refers to the current time. Finally,
           relative times may be specified, prefixed with "-" or "+", referring
           to times before or after the current time, respectively.
...
SEE ALSO
       systemd(1), systemd-journald.service(8), systemctl(1), coredumpctl(1),
       systemd.journal-fields(7), journald.conf(5)
...


- no reference to systemd.time(7)

Comment 6 Jan Synacek 2015-11-10 12:11:05 UTC
https://github.com/systemd/systemd/pull/1830

Comment 7 Karel Volný 2015-11-10 12:41:17 UTC
(In reply to Jan Synacek from comment #6)
> https://github.com/systemd/systemd/pull/1830

well, I believe when refering to the full specification, the excerpt here could be shortened, but thanks anyways, definitely it's an improvement for someone not familiar with systemd (see above, even Lennart himself needed second try to realise :-))

Comment 8 Fedora Update System 2015-12-14 11:18:43 UTC
systemd-222-9.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-76fc543765

Comment 9 Fedora Update System 2015-12-14 12:29:39 UTC
systemd-222-10.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-76fc543765

Comment 10 Fedora Update System 2015-12-15 10:54:37 UTC
systemd-222-10.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update systemd'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-76fc543765

Comment 11 Fedora Update System 2015-12-17 07:23:54 UTC
systemd-222-10.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.