chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
journald: log driver messages at LOG_INFO
[elogind.git]
/
src
/
journal
/
journald.c
diff --git
a/src/journal/journald.c
b/src/journal/journald.c
index 17aac8877b778f663669617e16097bc6d4456aa2..8cf8c78274f788a361bb3221de2cd9f2f7347b9d 100644
(file)
--- a/
src/journal/journald.c
+++ b/
src/journal/journald.c
@@
-393,7
+393,7
@@
static void server_vacuum(Server *s) {
if (s->system_journal) {
if (asprintf(&p, "/var/log/journal/%s", ids) < 0) {
if (s->system_journal) {
if (asprintf(&p, "/var/log/journal/%s", ids) < 0) {
- log_
error("Out of memory."
);
+ log_
oom(
);
return;
}
return;
}
@@
-405,7
+405,7
@@
static void server_vacuum(Server *s) {
if (s->runtime_journal) {
if (asprintf(&p, "/run/log/journal/%s", ids) < 0) {
if (s->runtime_journal) {
if (asprintf(&p, "/run/log/journal/%s", ids) < 0) {
- log_
error("Out of memory."
);
+ log_
oom(
);
return;
}
return;
}
@@
-721,7
+721,7
@@
static void driver_message(Server *s, sd_id128_t message_id, const char *format,
assert(s);
assert(format);
assert(s);
assert(format);
- IOVEC_SET_STRING(iovec[n++], "PRIORITY=
5
");
+ IOVEC_SET_STRING(iovec[n++], "PRIORITY=
6
");
IOVEC_SET_STRING(iovec[n++], "_TRANSPORT=driver");
memcpy(buffer, "MESSAGE=", 8);
IOVEC_SET_STRING(iovec[n++], "_TRANSPORT=driver");
memcpy(buffer, "MESSAGE=", 8);
@@
-868,7
+868,8
@@
static void forward_syslog_iovec(Server *s, const struct iovec *iovec, unsigned
return;
}
return;
}
- log_debug("Failed to forward syslog message: %m");
+ if (errno != ENOENT)
+ log_debug("Failed to forward syslog message: %m");
}
static void forward_syslog_raw(Server *s, int priority, const char *buffer, struct ucred *ucred, struct timeval *tv) {
}
static void forward_syslog_raw(Server *s, int priority, const char *buffer, struct ucred *ucred, struct timeval *tv) {
@@
-1269,7
+1270,7
@@
static void process_native_message(
u = MAX((n+N_IOVEC_META_FIELDS+1) * 2U, 4U);
c = realloc(iovec, u * sizeof(struct iovec));
if (!c) {
u = MAX((n+N_IOVEC_META_FIELDS+1) * 2U, 4U);
c = realloc(iovec, u * sizeof(struct iovec));
if (!c) {
- log_
error("Out of memory"
);
+ log_
oom(
);
break;
}
break;
}
@@
-1356,7
+1357,7
@@
static void process_native_message(
k = malloc((e - p) + 1 + l);
if (!k) {
k = malloc((e - p) + 1 + l);
if (!k) {
- log_
error("Out of memory"
);
+ log_
oom(
);
break;
}
break;
}
@@
-1449,7
+1450,7
@@
static void process_native_file(
p = malloc(st.st_size);
if (!p) {
p = malloc(st.st_size);
if (!p) {
- log_
error("Out of memory"
);
+ log_
oom(
);
return;
}
return;
}
@@
-1541,10
+1542,8
@@
static int stdout_stream_line(StdoutStream *s, char *p) {
s->identifier = NULL;
else {
s->identifier = strdup(p);
s->identifier = NULL;
else {
s->identifier = strdup(p);
- if (!s->identifier) {
- log_error("Out of memory");
- return -ENOMEM;
- }
+ if (!s->identifier)
+ return log_oom();
}
s->state = STDOUT_STREAM_UNIT_ID;
}
s->state = STDOUT_STREAM_UNIT_ID;
@@
-1556,10
+1555,8
@@
static int stdout_stream_line(StdoutStream *s, char *p) {
s->unit_id = NULL;
else {
s->unit_id = strdup(p);
s->unit_id = NULL;
else {
s->unit_id = strdup(p);
- if (!s->unit_id) {
- log_error("Out of memory");
- return -ENOMEM;
- }
+ if (!s->unit_id)
+ return log_oom();
}
}
}
}
@@
-1760,9
+1757,8
@@
static int stdout_stream_new(Server *s) {
stream = new0(StdoutStream, 1);
if (!stream) {
stream = new0(StdoutStream, 1);
if (!stream) {
- log_error("Out of memory.");
close_nointr_nofail(fd);
close_nointr_nofail(fd);
- return
-ENOMEM
;
+ return
log_oom()
;
}
stream->fd = fd;
}
stream->fd = fd;
@@
-2146,11
+2142,8
@@
finish:
journal_file_close(s->runtime_journal);
s->runtime_journal = NULL;
journal_file_close(s->runtime_journal);
s->runtime_journal = NULL;
- if (r >= 0) {
- char path[] = "/run/log/journal/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
- sd_id128_to_string(machine, path + 17);
- rm_rf(path, false, true, false);
- }
+ if (r >= 0)
+ rm_rf("/run/log/journal", false, true, false);
return r;
}
return r;
}
@@
-2227,6
+2220,8
@@
static int process_event(Server *s, struct epoll_event *ev) {
return -errno;
}
return -errno;
}
+ log_info("Received SIG%s", signal_to_string(sfsi.ssi_signo));
+
if (sfsi.ssi_signo == SIGUSR1) {
touch("/run/systemd/journal/flushed");
server_flush_to_var(s);
if (sfsi.ssi_signo == SIGUSR1) {
touch("/run/systemd/journal/flushed");
server_flush_to_var(s);
@@
-2239,7
+2234,6
@@
static int process_event(Server *s, struct epoll_event *ev) {
return 1;
}
return 1;
}
- log_debug("Received SIG%s", signal_to_string(sfsi.ssi_signo));
return 0;
} else if (ev->data.fd == s->proc_kmsg_fd) {
return 0;
} else if (ev->data.fd == s->proc_kmsg_fd) {
@@
-2754,10
+2748,8
@@
static int server_init(Server *s) {
server_parse_proc_cmdline(s);
s->user_journals = hashmap_new(trivial_hash_func, trivial_compare_func);
server_parse_proc_cmdline(s);
s->user_journals = hashmap_new(trivial_hash_func, trivial_compare_func);
- if (!s->user_journals) {
- log_error("Out of memory.");
- return -ENOMEM;
- }
+ if (!s->user_journals)
+ return log_oom();
s->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
if (s->epoll_fd < 0) {
s->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
if (s->epoll_fd < 0) {