From a83f403760cb63b1bf7787e9ff325ffb6d891d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 1 Jul 2014 23:18:44 -0400 Subject: [PATCH] journal-remote: improve some messages --- src/journal-remote/journal-remote-parse.c | 6 +++--- src/journal-remote/journal-remote-write.c | 4 +++- src/journal-remote/journal-remote.c | 16 ++++++++-------- src/journal-remote/journal-upload.c | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/journal-remote/journal-remote-parse.c b/src/journal-remote/journal-remote-parse.c index 14af55ca552..90d50a7ad01 100644 --- a/src/journal-remote/journal-remote-parse.c +++ b/src/journal-remote/journal-remote-parse.c @@ -203,7 +203,7 @@ static int get_data_size(RemoteSource *source) { source->data_size = le64toh( *(uint64_t *) data ); if (source->data_size > DATA_SIZE_MAX) { - log_error("Stream declares field with size %zu > %u == DATA_SIZE_MAX", + log_error("Stream declares field with size %zu > DATA_SIZE_MAX = %u", source->data_size, DATA_SIZE_MAX); return -EINVAL; } @@ -429,8 +429,8 @@ int process_source(RemoteSource *source, Writer *writer, bool compress, bool sea return r; /* We have a full event */ - log_info("Received a full event from source@%p fd:%d (%s)", - source, source->fd, source->name); + log_debug("Received a full event from source@%p fd:%d (%s)", + source, source->fd, source->name); if (!source->iovw.count) { log_warning("Entry with no payload, skipping"); diff --git a/src/journal-remote/journal-remote-write.c b/src/journal-remote/journal-remote-write.c index 449636cd8c3..3b00ff52003 100644 --- a/src/journal-remote/journal-remote-write.c +++ b/src/journal-remote/journal-remote-write.c @@ -114,10 +114,12 @@ int writer_write(Writer *s, if (r >= 0) return 1; - log_info("%s: Write failed, rotating", s->journal->path); + log_debug("%s: Write failed, rotating: %s", s->journal->path, strerror(-r)); r = do_rotate(&s->journal, compress, seal); if (r < 0) return r; + else + log_info("%s: Successfully rotated journal", s->journal->path); log_debug("Retrying write."); r = journal_file_append_entry(s->journal, ts, iovw->iovec, iovw->count, diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 827916d1a0a..d37fac3ceae 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -500,8 +500,8 @@ static int process_http_upload( r = get_writer(server, source->name, NULL, &w); if (r < 0) { - log_warning("Failed to get writer for source %s (%s): %s", - source->name, source->name, strerror(-r)); + log_warning("Failed to get writer for source %s: %s", + source->name, strerror(-r)); return mhd_respondf(connection, MHD_HTTP_SERVICE_UNAVAILABLE, "Failed to get writer for connection: %s.\n", @@ -509,7 +509,7 @@ static int process_http_upload( } if (*upload_data_size) { - log_info("Received %zu bytes", *upload_data_size); + log_debug("Received %zu bytes", *upload_data_size); r = push_data(source, upload_data, *upload_data_size); if (r < 0) @@ -951,7 +951,7 @@ static int remoteserver_init(RemoteServer *s, STRV_FOREACH(file, arg_files) { if (streq(*file, "-")) { - log_info("Reading standard input..."); + log_info("Using standard input as source."); fd = STDIN_FILENO; output_name = "stdin"; @@ -1061,8 +1061,8 @@ static int dispatch_raw_source_event(sd_event_source *event, r = get_writer(s, source->name, NULL, &w); if (r < 0) { - log_warning("Failed to get writer for source %s (%s): %s", - source->name, source->name, strerror(-r)); + log_warning("Failed to get writer for source %s: %s", + source->name, strerror(-r)); return r; } @@ -1077,7 +1077,7 @@ static int dispatch_raw_source_event(sd_event_source *event, if (remaining > 0) log_warning("Premature EOF. %zu bytes lost.", remaining); remove_source(s, source->fd); - log_info("%zd active source remaining", s->active); + log_info("%zd active sources remaining", s->active); return 0; } else if (r == -E2BIG) { log_error("Entry too big, skipped"); @@ -1195,7 +1195,7 @@ static int parse_config(void) { static void help(void) { printf("%s [OPTIONS...] {FILE|-}...\n\n" - "Write external journal events to a journal file.\n\n" + "Write external journal events to journal file(s).\n\n" "Options:\n" " --url=URL Read events from systemd-journal-gatewayd at URL\n" " --getter=COMMAND Read events from the output of COMMAND\n" diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index 680073f4d94..95be9a0e21f 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -479,7 +479,7 @@ static void help(void) { printf("%s -u URL {FILE|-}...\n\n" "Upload journal events to a remote server.\n\n" "Options:\n" - " --url=URL Upload to this address\n" + " -u --url=URL Upload to this address\n" " --key=FILENAME Specify key in PEM format\n" " --cert=FILENAME Specify certificate in PEM format\n" " --trust=FILENAME Specify CA certificate in PEM format\n"