[systemd-devel] [PATCH] journalctl: --follow with --since behaviour

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Nov 26 21:41:28 PST 2014


On Tue, Nov 25, 2014 at 08:47:49PM +0100, Andrej Manduch wrote:
> journalctl will print not only 10 lines but all relevant when --since is
> in use
Hi,

patch applied.

> --- >8 ---
git am treates the stuff above this line as the commit message, while
the stuff below is more interesting. I copied it into the commit
message.

Zbyszek

> 
> Hi,
> 
> When I tryed to run journalctl with --follow and --since arguments it
> behaved very strangely.
> First It prints logs from what I specified in --since argument, then
> printed 10 lines (as is default in --follow) and when app put something
> new in to log journalctl printed everithing from the last printed line.
> 
> How to reproduce:
> 1. run: journalctl -m --since 14:00 --follow
> Then you'll see 10 lines of logs since 14:00. After that wait until some
> app add something in the journal or just run `systemd-cat echo test`
> 2. After that journalctl will print every single line since 14:00 and will
> follow as expected.
> 
> As long as --since and --follow will eventually print all relevant
> lines, I seen no reason why not to print them right away and not after
> first new message in journal.
> 
> Relevant bugzillas:
>         https://bugs.freedesktop.org/show_bug.cgi?id=71546
Closed.

>         https://bugs.freedesktop.org/show_bug.cgi?id=64291
This one was a different issue actually, but it can be now closed too.

> ---
>  src/journal/journalctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
> index b168d1e..904880b 100644
> --- a/src/journal/journalctl.c
> +++ b/src/journal/journalctl.c
> @@ -712,7 +712,7 @@ static int parse_argv(int argc, char *argv[]) {
>                          assert_not_reached("Unhandled option");
>                  }
>  
> -        if (arg_follow && !arg_no_tail && arg_lines == ARG_LINES_DEFAULT)
> +        if (arg_follow && !arg_no_tail && !arg_since && arg_lines == ARG_LINES_DEFAULT)
>                  arg_lines = 10;
>  
>          if (!!arg_directory + !!arg_file + !!arg_machine > 1) {

Zbyszek


More information about the systemd-devel mailing list