Hi,

Having to often use journalctl it has slowly driven me insane with the default options not matching common use cases.

Attached is already a patch to start the journal at the end. Usually people check the logs when something went wrong, and don't care about what happened three weeks ago at the beginning of the log. Yes you can press the "end" key to skip to the end but in some cases that freezes up the console for over a minute.

Other gripes are --no-pager... way too long to type on a virtual keyboard when you are trying to use the logs old style with common unix utilities. Maybe not having it by default, or introducing a shorter command switch should not be hard to add.

And also I would like to see the full logs always by default. Usually after lots of searching you find the offending log entry for the error, only to find out you forgot to pass the right command line options to journalctl and the important bit is cut off.

If you guys are willing to also consider those other two gripes I will glady submit patches for those also.

Regards,

Philippe
>From b4c8bd945bc987edd64702e781daea2caff8eeab Mon Sep 17 00:00:00 2001
From: Philippe De Swert <philippe.desw...@jollamobile.com>
Date: Mon, 18 Aug 2014 14:39:19 +0300
Subject: [PATCH] journalctl : automatically go to the end of the log

Usually we do not care about the beginning of the log, as we want to look
at it when something went wrong. So usually this would be the end. So changing
the end feature into a start feature will cause less typing. (Also jumping to
the end of a log with the end key sometimes takes a considerable amount of time,
so we avoid that issue here too). To restore the old behaviour to start at the
beginning of the log, there is now -s or --pager-start. -e is kept for backwards
compatability.

Signed-off-by: Philippe De Swert <philippe.desw...@jollamobile.com>
---
 src/journal/journalctl.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 5c4a71d..67f3a26 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -63,7 +63,7 @@
 #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
 
 static OutputMode arg_output = OUTPUT_SHORT;
-static bool arg_pager_end = false;
+static bool arg_pager_end = true;
 static bool arg_follow = false;
 static bool arg_full = true;
 static bool arg_all = false;
@@ -182,6 +182,7 @@ static void help(void) {
                "     --user-unit=UNIT      Show data only from the specified user session unit\n"
                "  -p --priority=RANGE      Show only messages within the specified priority range\n"
                "  -e --pager-end           Immediately jump to end of the journal in the pager\n"
+               "  -s --pager-start         Start at the beginning of the journal in the pager\n"
                "  -f --follow              Follow the journal\n"
                "  -n --lines[=INTEGER]     Number of journal entries to show\n"
                "     --no-tail             Show all lines, even in follow mode\n"
@@ -255,6 +256,7 @@ static int parse_argv(int argc, char *argv[]) {
                 { "version" ,       no_argument,       NULL, ARG_VERSION        },
                 { "no-pager",       no_argument,       NULL, ARG_NO_PAGER       },
                 { "pager-end",      no_argument,       NULL, 'e'                },
+                { "pager-start",    no_argument,       NULL, 's'                },
                 { "follow",         no_argument,       NULL, 'f'                },
                 { "force",          no_argument,       NULL, ARG_FORCE          },
                 { "output",         required_argument, NULL, 'o'                },
@@ -304,7 +306,7 @@ static int parse_argv(int argc, char *argv[]) {
         assert(argc >= 0);
         assert(argv);
 
-        while ((c = getopt_long(argc, argv, "hefo:aln::qmb::kD:p:c:u:F:xrM:", options, NULL)) >= 0)
+        while ((c = getopt_long(argc, argv, "hesfo:aln::qmb::kD:p:c:u:F:xrM:", options, NULL)) >= 0)
 
                 switch (c) {
 
@@ -329,6 +331,15 @@ static int parse_argv(int argc, char *argv[]) {
 
                         break;
 
+                case 's':
+                        arg_pager_end = false;
+
+                        if (arg_lines < 0)
+                                arg_lines = 1000;
+
+                        break;
+
+
                 case 'f':
                         arg_follow = true;
                         break;
-- 
1.8.1.2

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to