Re: [systemd-devel] [PATCH] query for user unit information in the journal
On Thu, 21.02.13 16:39, Daniel Wallace (danielwall...@gtmanfred.com) wrote: > Add --user-unit= to make it possible to query for user logs by the name > of the service. Thanks! Applied! > --- > man/journalctl.xml | 11 +++ > shell-completion/systemd-bash-completion.sh | 5 - > shell-completion/systemd-zsh-completion.zsh | 1 + > src/journal/journalctl.c| 13 - > 4 files changed, 28 insertions(+), 2 deletions(-) > > diff --git a/man/journalctl.xml b/man/journalctl.xml > index 5ed0e1f..09a96ac 100644 > --- a/man/journalctl.xml > +++ b/man/journalctl.xml > @@ -306,6 +306,17 @@ > > > > +--user-unit= > + > +Show data only of the > +specified user session unit. This will > +add a match for > +_SYSTEMD_USER_UNIT= > +for the specified > +unit. > + > + > + > -p > --priority= > > diff --git a/shell-completion/systemd-bash-completion.sh > b/shell-completion/systemd-bash-completion.sh > index 1132b3c..117dc55 100644 > --- a/shell-completion/systemd-bash-completion.sh > +++ b/shell-completion/systemd-bash-completion.sh > @@ -300,7 +300,7 @@ _journalctl() { >-h --help -l --local --new-id128 -m --merge > --no-pager >--no-tail -q --quiet --setup-keys --this-boot > --verify >--version --list-catalog --update-catalog' > - [ARG]='-D --directory -F --field -o --output -u > --unit' > + [ARG]='-D --directory -F --field -o --output -u > --unit --user-unit' > [ARGUNKNOWN]='-c --cursor --interval -n --lines -p > --priority --since --until >--verify-key' > ) > @@ -320,6 +320,9 @@ _journalctl() { > --unit|-u) > comps=$(journalctl -F '_SYSTEMD_UNIT') > ;; > +--user-unit) > +comps=$(journalctl -F '_SYSTEMD_USER_UNIT') > +;; > *) > return 0 > ;; > diff --git a/shell-completion/systemd-zsh-completion.zsh > b/shell-completion/systemd-zsh-completion.zsh > index 177a564..46e29b2 100644 > --- a/shell-completion/systemd-zsh-completion.zsh > +++ b/shell-completion/systemd-zsh-completion.zsh > @@ -70,6 +70,7 @@ _ctls() > {-c,--cursor=}'[Start showing entries from specified > cursor]:cursors:_journal_fields __CURSORS' \ > {-b,--this-boot}'[Show data only from current boot]' \ > {-u,--unit=}'[Show data only from the specified > unit]:units:_journal_fields _SYSTEMD_UNIT' \ > +'--user-unit[Show data only from the specified user session > unit]:units:_journal_fields _SYSTEMD_USER_UNIT' \ > {-p,--priority=}'[Show only messages within the specified > priority range]:priority:_journal_fields PRIORITY' \ > {-f,--follow}'[Follow journal]' \ > {-n,--lines=}'[Number of journal entries to show]:integer' \ > diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c > index 0afeef9..bfea699 100644 > --- a/src/journal/journalctl.c > +++ b/src/journal/journalctl.c > @@ -75,6 +75,7 @@ static usec_t arg_interval = DEFAULT_FSS_INTERVAL_USEC; > static usec_t arg_since, arg_until; > static bool arg_since_set = false, arg_until_set = false; > static const char *arg_unit = NULL; > +static const char *arg_unit_type = NULL; > static const char *arg_field = NULL; > static bool arg_catalog = false; > > @@ -99,6 +100,7 @@ static int help(void) { > " -c --cursor=CURSOR Start showing entries from > specified cursor\n" > " -b --this-boot Show data only from current boot\n" > " -u --unit=UNIT Show data only from the specified > unit\n" > + " --user-unit=UNITShow data only from the specified > user session unit\n" > " -p --priority=RANGEShow only messages within the > specified priority range\n" > " -f --followFollow journal\n" > " -n --lines[=INTEGER] Number of journal entries to show\n" > @@ -150,6 +152,7 @@ static int parse_argv(int argc, char *argv[]) { > ARG_DISK_USAGE, > ARG_SINCE, > ARG_UNTIL, > +ARG_USER_UNIT, > ARG_LIST_CATALOG, > ARG_UPDATE_CATALOG > }; > @@ -17
[systemd-devel] [PATCH] query for user unit information in the journal
Add --user-unit= to make it possible to query for user logs by the name of the service. --- man/journalctl.xml | 11 +++ shell-completion/systemd-bash-completion.sh | 5 - shell-completion/systemd-zsh-completion.zsh | 1 + src/journal/journalctl.c| 13 - 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/man/journalctl.xml b/man/journalctl.xml index 5ed0e1f..09a96ac 100644 --- a/man/journalctl.xml +++ b/man/journalctl.xml @@ -306,6 +306,17 @@ +--user-unit= + +Show data only of the +specified user session unit. This will +add a match for +_SYSTEMD_USER_UNIT= +for the specified +unit. + + + -p --priority= diff --git a/shell-completion/systemd-bash-completion.sh b/shell-completion/systemd-bash-completion.sh index 1132b3c..117dc55 100644 --- a/shell-completion/systemd-bash-completion.sh +++ b/shell-completion/systemd-bash-completion.sh @@ -300,7 +300,7 @@ _journalctl() { -h --help -l --local --new-id128 -m --merge --no-pager --no-tail -q --quiet --setup-keys --this-boot --verify --version --list-catalog --update-catalog' - [ARG]='-D --directory -F --field -o --output -u --unit' + [ARG]='-D --directory -F --field -o --output -u --unit --user-unit' [ARGUNKNOWN]='-c --cursor --interval -n --lines -p --priority --since --until --verify-key' ) @@ -320,6 +320,9 @@ _journalctl() { --unit|-u) comps=$(journalctl -F '_SYSTEMD_UNIT') ;; +--user-unit) +comps=$(journalctl -F '_SYSTEMD_USER_UNIT') +;; *) return 0 ;; diff --git a/shell-completion/systemd-zsh-completion.zsh b/shell-completion/systemd-zsh-completion.zsh index 177a564..46e29b2 100644 --- a/shell-completion/systemd-zsh-completion.zsh +++ b/shell-completion/systemd-zsh-completion.zsh @@ -70,6 +70,7 @@ _ctls() {-c,--cursor=}'[Start showing entries from specified cursor]:cursors:_journal_fields __CURSORS' \ {-b,--this-boot}'[Show data only from current boot]' \ {-u,--unit=}'[Show data only from the specified unit]:units:_journal_fields _SYSTEMD_UNIT' \ +'--user-unit[Show data only from the specified user session unit]:units:_journal_fields _SYSTEMD_USER_UNIT' \ {-p,--priority=}'[Show only messages within the specified priority range]:priority:_journal_fields PRIORITY' \ {-f,--follow}'[Follow journal]' \ {-n,--lines=}'[Number of journal entries to show]:integer' \ diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 0afeef9..bfea699 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -75,6 +75,7 @@ static usec_t arg_interval = DEFAULT_FSS_INTERVAL_USEC; static usec_t arg_since, arg_until; static bool arg_since_set = false, arg_until_set = false; static const char *arg_unit = NULL; +static const char *arg_unit_type = NULL; static const char *arg_field = NULL; static bool arg_catalog = false; @@ -99,6 +100,7 @@ static int help(void) { " -c --cursor=CURSOR Start showing entries from specified cursor\n" " -b --this-boot Show data only from current boot\n" " -u --unit=UNIT Show data only from the specified unit\n" + " --user-unit=UNITShow data only from the specified user session unit\n" " -p --priority=RANGEShow only messages within the specified priority range\n" " -f --followFollow journal\n" " -n --lines[=INTEGER] Number of journal entries to show\n" @@ -150,6 +152,7 @@ static int parse_argv(int argc, char *argv[]) { ARG_DISK_USAGE, ARG_SINCE, ARG_UNTIL, +ARG_USER_UNIT, ARG_LIST_CATALOG, ARG_UPDATE_CATALOG }; @@ -179,6 +182,7 @@ static int parse_argv(int argc, char *argv[]) { { "cursor", required_argument, NULL, 'c' }, { "since",required_argument, NULL, ARG_SINCE}, { "until",required_argument, NULL, ARG_UNTIL}, +