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 the slice of a process along with each message in _SYSTEMD_SLICE=
[elogind.git]
/
src
/
journal
/
journald-server.c
diff --git
a/src/journal/journald-server.c
b/src/journal/journald-server.c
index 14afcfb794eb09d4f23bb368c736ab9fe52433fb..709fa8b7d09921eadc246775d13461c963681729 100644
(file)
--- a/
src/journal/journald-server.c
+++ b/
src/journal/journald-server.c
@@
-638,6
+638,12
@@
static void dispatch_message_real(
IOVEC_SET_STRING(iovec[n++], x);
}
IOVEC_SET_STRING(iovec[n++], x);
}
+ if (cg_path_get_slice(c, &t) >= 0) {
+ x = strappenda("_SYSTEMD_SLICE=", t);
+ free(t);
+ IOVEC_SET_STRING(iovec[n++], x);
+ }
+
free(c);
}
free(c);
}
@@
-897,8
+903,10
@@
static int system_journal_open(Server *s) {
char ids[33];
r = sd_id128_get_machine(&machine);
char ids[33];
r = sd_id128_get_machine(&machine);
- if (r < 0)
+ if (r < 0) {
+ log_error("Failed to get machine id: %s", strerror(-r));
return r;
return r;
+ }
sd_id128_to_string(machine, ids);
sd_id128_to_string(machine, ids);
@@
-1000,10
+1008,8
@@
int server_flush_to_var(Server *s) {
log_debug("Flushing to /var...");
r = sd_id128_get_machine(&machine);
log_debug("Flushing to /var...");
r = sd_id128_get_machine(&machine);
- if (r < 0) {
- log_error("Failed to get machine id: %s", strerror(-r));
+ if (r < 0)
return r;
return r;
- }
r = sd_journal_open(&j, SD_JOURNAL_RUNTIME_ONLY);
if (r < 0) {
r = sd_journal_open(&j, SD_JOURNAL_RUNTIME_ONLY);
if (r < 0) {
@@
-1092,6
+1098,8
@@
int process_event(Server *s, struct epoll_event *ev) {
}
if (sfsi.ssi_signo == SIGUSR1) {
}
if (sfsi.ssi_signo == SIGUSR1) {
+ log_info("Received request to flush runtime journal from PID %"PRIu32,
+ sfsi.ssi_pid);
touch("/run/systemd/journal/flushed");
server_flush_to_var(s);
server_sync(s);
touch("/run/systemd/journal/flushed");
server_flush_to_var(s);
server_sync(s);
@@
-1099,6
+1107,8
@@
int process_event(Server *s, struct epoll_event *ev) {
}
if (sfsi.ssi_signo == SIGUSR2) {
}
if (sfsi.ssi_signo == SIGUSR2) {
+ log_info("Received request to rotate journal from PID %"PRIu32,
+ sfsi.ssi_pid);
server_rotate(s);
server_vacuum(s);
return 1;
server_rotate(s);
server_vacuum(s);
return 1;