diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-07-13 00:29:26 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-07-13 00:32:32 +0200 |
commit | cbdca8525b4f36297cb9e5cb090a9648763ed1bf (patch) | |
tree | 1d4665994000b53b132e93d6e0c628d39ff9b706 /src/journal/journalctl.c | |
parent | 362a3f8122e070589a4d61f7752b990090c75432 (diff) |
journal: beef up journal matches considerably
we now can take multiple matches, and they will apply as AND if they
apply to different fields and OR if they apply to the same fields. Also,
terms of this kind can be combined with an overreaching OR.
Diffstat (limited to 'src/journal/journalctl.c')
-rw-r--r-- | src/journal/journalctl.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 43cd2a3fef..65b3bd5a86 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -225,7 +225,9 @@ static int add_matches(sd_journal *j, char **args) { STRV_FOREACH(i, args) { - if (path_is_absolute(*i)) { + if (streq(*i, "+")) + r = sd_journal_add_disjunction(j); + else if (path_is_absolute(*i)) { char *p; const char *path; struct stat st; @@ -249,7 +251,7 @@ static int add_matches(sd_journal *j, char **args) { return -ENOMEM; } - r = sd_journal_add_match(j, t, strlen(t)); + r = sd_journal_add_match(j, t, 0); free(t); } else { free(p); @@ -259,10 +261,10 @@ static int add_matches(sd_journal *j, char **args) { free(p); } else - r = sd_journal_add_match(j, *i, strlen(*i)); + r = sd_journal_add_match(j, *i, 0); if (r < 0) { - log_error("Failed to add match: %s", strerror(-r)); + log_error("Failed to add match '%s': %s", *i, strerror(-r)); return r; } } |