summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-08-22 02:53:51 +0200
committerLennart Poettering <lennart@poettering.net>2012-08-22 02:53:51 +0200
commit671e021c92c835c6c701dc61463149d05b6f31af (patch)
treecd3e10b9be9ba66291da0af2809671f03af99510 /src
parentbdfb9e7f7c315af5a6755ac4701b696ce2305a19 (diff)
journald: write tags also to user journal files
Diffstat (limited to 'src')
-rw-r--r--src/journal/journal-authenticate.c2
-rw-r--r--src/journal/journald.c23
2 files changed, 19 insertions, 6 deletions
diff --git a/src/journal/journal-authenticate.c b/src/journal/journal-authenticate.c
index fe5b6bd506..586daf34cd 100644
--- a/src/journal/journal-authenticate.c
+++ b/src/journal/journal-authenticate.c
@@ -212,7 +212,7 @@ int journal_file_maybe_append_tag(JournalFile *f, uint64_t realtime) {
return 0;
if (realtime <= 0)
- realtime = now(CLOCK_MONOTONIC);
+ realtime = now(CLOCK_REALTIME);
r = journal_file_fsprg_need_evolve(f, realtime);
if (r <= 0)
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 2429dd3e27..5dc5c95cfa 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -2940,6 +2940,22 @@ static int server_init(Server *s) {
return 0;
}
+static void maybe_append_tags(Server *s) {
+#ifdef HAVE_GCRYPT
+ JournalFile *f;
+ Iterator i;
+ usec_t n;
+
+ n = now(CLOCK_REALTIME);
+
+ if (s->system_journal)
+ journal_file_maybe_append_tag(s->system_journal, n);
+
+ HASHMAP_FOREACH(f, s->user_journals, i)
+ journal_file_maybe_append_tag(f, n);
+#endif
+}
+
static void server_done(Server *s) {
JournalFile *f;
assert(s);
@@ -3040,7 +3056,7 @@ int main(int argc, char *argv[]) {
journal_file_next_evolve_usec(server.system_journal, &u)) {
usec_t n;
- n = now(CLOCK_MONOTONIC);
+ n = now(CLOCK_REALTIME);
if (n >= u)
t = 0;
@@ -3069,10 +3085,7 @@ int main(int argc, char *argv[]) {
break;
}
-#ifdef HAVE_GCRYPT
- if (server.system_journal)
- journal_file_maybe_append_tag(server.system_journal, 0);
-#endif
+ maybe_append_tags(&server);
}
log_debug("systemd-journald stopped as pid %lu", (unsigned long) getpid());