diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-09-21 22:50:26 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-09-21 22:50:26 +0200 |
commit | c2893c4b346b3fe33a3f983a83818e91affa9631 (patch) | |
tree | 2ff1fbcd112810e23fb1252c607d0f0a3099b05e /src | |
parent | 1705594f597ed12f38bee309b3fdb3f691e2021b (diff) |
journald: log how big the journal files may grow
Diffstat (limited to 'src')
-rw-r--r-- | src/journal/journald.c | 24 | ||||
-rw-r--r-- | src/systemd/sd-id128.h | 2 |
2 files changed, 20 insertions, 6 deletions
diff --git a/src/journal/journald.c b/src/journal/journald.c index 164e1087d1..3267fffed9 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -714,9 +714,11 @@ void server_driver_message(Server *s, sd_id128_t message_id, const char *format, char_array_0(buffer); IOVEC_SET_STRING(iovec[n++], buffer); - snprintf(mid, sizeof(mid), "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(message_id)); - char_array_0(mid); - IOVEC_SET_STRING(iovec[n++], mid); + if (!sd_id128_equal(message_id, SD_ID128_NULL)) { + snprintf(mid, sizeof(mid), "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(message_id)); + char_array_0(mid); + IOVEC_SET_STRING(iovec[n++], mid); + } zero(ucred); ucred.pid = getpid(); @@ -827,9 +829,14 @@ static int system_journal_open(Server *s) { r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, s->compress, s->seal, &s->system_metrics, s->mmap, NULL, &s->system_journal); free(fn); - if (r >= 0) + if (r >= 0) { + char fb[FORMAT_BYTES_MAX]; + server_fix_perms(s, s->system_journal, 0); - else if (r < 0) { + server_driver_message(s, SD_ID128_NULL, "Allowing system journal files to grow to %s.", + format_bytes(fb, sizeof(fb), s->system_metrics.max_use)); + + } else if (r < 0) { if (r != -ENOENT && r != -EROFS) log_warning("Failed to open system journal: %s", strerror(-r)); @@ -876,8 +883,13 @@ static int system_journal_open(Server *s) { } } - if (s->runtime_journal) + if (s->runtime_journal) { + char fb[FORMAT_BYTES_MAX]; + server_fix_perms(s, s->runtime_journal, 0); + server_driver_message(s, SD_ID128_NULL, "Allowing runtime journal files to grow to %s.", + format_bytes(fb, sizeof(fb), s->runtime_metrics.max_use)); + } } return r; diff --git a/src/systemd/sd-id128.h b/src/systemd/sd-id128.h index 126d83ce8a..05521ae4bb 100644 --- a/src/systemd/sd-id128.h +++ b/src/systemd/sd-id128.h @@ -64,6 +64,8 @@ static inline int sd_id128_equal(sd_id128_t a, sd_id128_t b) { return memcmp(&a, &b, 16) == 0; } +#define SD_ID128_NULL ((sd_id128_t) { .qwords = { 0, 0 }}) + #ifdef __cplusplus } #endif |