man/journal-enumerate-fields.c
raw| 1 | /* SPDX-License-Identifier: MIT-0 */ |
| 2 | |
| 3 | #include <errno.h> |
| 4 | #include <stdio.h> |
| 5 | #include <systemd/sd-journal.h> |
| 6 | |
| 7 | int main(int argc, char *argv[]) { |
| 8 | sd_journal *j; |
| 9 | const char *field; |
| 10 | int r; |
| 11 | |
| 12 | r = sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY); |
| 13 | if (r < 0) { |
| 14 | fprintf(stderr, "Failed to open journal: %s\n", strerror(-r)); |
| 15 | return 1; |
| 16 | } |
| 17 | SD_JOURNAL_FOREACH_FIELD(j, field) |
| 18 | printf("%s\n", field); |
| 19 | sd_journal_close(j); |
| 20 | return 0; |
| 21 | } |