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