summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-11-21 00:28:00 +0100
committerLennart Poettering <lennart@poettering.net>2012-11-21 00:28:00 +0100
commit93b73b064c663d6248bebfbbbd82989b5ca10fc5 (patch)
tree464aea01e7952ddcf7088a594e0bfdf2e4647a0a /src/shared
parentf2cf0403c99e8fa44c14b0ef70af90801f8681f0 (diff)
journal: by default do not decompress dat objects larger than 64K
This introduces a new data threshold setting for sd_journal objects which controls the maximum size of objects to decompress. This is relieves the library from having to decompress full data objects even if a client program is only interested in the initial part of them. This speeds up "systemd-coredumpctl" drastically when invoked without parameters.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/logs-show.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index cb93761bd1..ca5ad43b63 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -91,7 +91,7 @@ static bool shall_print(const char *p, size_t l, OutputFlags flags) {
if (flags & OUTPUT_SHOW_ALL)
return true;
- if (l > PRINT_THRESHOLD)
+ if (l >= PRINT_THRESHOLD)
return false;
if (!utf8_is_printable_n(p, l))
@@ -119,6 +119,8 @@ static int output_short(
assert(f);
assert(j);
+ sd_journal_set_data_threshold(j, flags & OUTPUT_SHOW_ALL ? 0 : PRINT_THRESHOLD);
+
SD_JOURNAL_FOREACH_DATA(j, data, length) {
r = parse_field(data, length, "PRIORITY=", &priority, &priority_len);
@@ -308,6 +310,8 @@ static int output_verbose(
assert(f);
assert(j);
+ sd_journal_set_data_threshold(j, 0);
+
r = sd_journal_get_realtime_usec(j, &realtime);
if (r < 0) {
log_error("Failed to get realtime timestamp: %s", strerror(-r));
@@ -368,6 +372,8 @@ static int output_export(
assert(j);
+ sd_journal_set_data_threshold(j, 0);
+
r = sd_journal_get_realtime_usec(j, &realtime);
if (r < 0) {
log_error("Failed to get realtime timestamp: %s", strerror(-r));
@@ -441,7 +447,7 @@ void json_escape(
assert(f);
assert(p);
- if (!(flags & OUTPUT_SHOW_ALL) && l > JSON_THRESHOLD)
+ if (!(flags & OUTPUT_SHOW_ALL) && l >= JSON_THRESHOLD)
fputs("null", f);
@@ -502,6 +508,8 @@ static int output_json(
assert(j);
+ sd_journal_set_data_threshold(j, flags & OUTPUT_SHOW_ALL ? 0 : JSON_THRESHOLD);
+
r = sd_journal_get_realtime_usec(j, &realtime);
if (r < 0) {
log_error("Failed to get realtime timestamp: %s", strerror(-r));
@@ -714,6 +722,8 @@ static int output_cat(
assert(j);
assert(f);
+ sd_journal_set_data_threshold(j, 0);
+
r = sd_journal_get_data(j, "MESSAGE", &data, &l);
if (r < 0) {
/* An entry without MESSAGE=? */