diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-10-18 22:31:58 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-10-18 22:34:42 +0200 |
commit | 082d0180f98199803c5db0dd0e86f2486843c2f1 (patch) | |
tree | 99fd1d3f6a752b71e1651efc23de4ae867fec4e4 /src/journal | |
parent | 240a5fe83e772d08d9e1f22e90163b37eea5ab45 (diff) |
journal: add high-level match option to filter by current boot id
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journal-gatewayd.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/journal/journal-gatewayd.c b/src/journal/journal-gatewayd.c index 1d0559fdb6..6a5db968e3 100644 --- a/src/journal/journal-gatewayd.c +++ b/src/journal/journal-gatewayd.c @@ -416,6 +416,38 @@ static int request_parse_arguments_iterator( return MHD_YES; } + if (streq(key, "boot")) { + if (isempty(value)) + r = true; + else { + r = parse_boolean(value); + if (r < 0) { + m->argument_parse_error = r; + return MHD_NO; + } + } + + if (r) { + char match[9 + 32 + 1] = "_BOOT_ID="; + sd_id128_t bid; + + r = sd_id128_get_boot(&bid); + if (r < 0) { + log_error("Failed to get boot ID: %s", strerror(-r)); + return MHD_NO; + } + + sd_id128_to_string(bid, match + 9); + r = sd_journal_add_match(m->journal, match, sizeof(match)-1); + if (r < 0) { + m->argument_parse_error = r; + return MHD_NO; + } + } + + return MHD_YES; + } + p = strjoin(key, "=", strempty(value), NULL); if (!p) { m->argument_parse_error = log_oom(); |