chiark / gitweb /
journal-remote: improve some messages
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 2 Jul 2014 03:18:44 +0000 (23:18 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 16 Jul 2014 02:34:41 +0000 (22:34 -0400)
src/journal-remote/journal-remote-parse.c
src/journal-remote/journal-remote-write.c
src/journal-remote/journal-remote.c
src/journal-remote/journal-upload.c

index 14af55c..90d50a7 100644 (file)
@@ -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");
index 449636c..3b00ff5 100644 (file)
@@ -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,
index 827916d..d37fac3 100644 (file)
@@ -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"
index 680073f..95be9a0 100644 (file)
@@ -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"