summaryrefslogtreecommitdiff
path: root/src/login/logind-session.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-08-24 22:21:20 +0200
committerLennart Poettering <lennart@poettering.net>2012-09-03 18:59:04 -0700
commit877d54e9b09e093c2102f519a84e2a52637ae035 (patch)
treeff7926d33cd29b9e2930cb401a7be412c7724241 /src/login/logind-session.c
parent88fae6e0441d4195e089434f07d3e7fd811d6297 (diff)
journal: generate structured journal messages for a number of events
Diffstat (limited to 'src/login/logind-session.c')
-rw-r--r--src/login/logind-session.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 16d4955d5d..77462a8d15 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -25,6 +25,8 @@
#include <sys/epoll.h>
#include <fcntl.h>
+#include "systemd/sd-id128.h"
+#include "systemd/sd-messages.h"
#include "strv.h"
#include "util.h"
#include "mkdir.h"
@@ -542,8 +544,13 @@ int session_start(Session *s) {
if (r < 0)
return r;
- log_full(s->type == SESSION_TTY || s->type == SESSION_X11 ? LOG_INFO : LOG_DEBUG,
- "New session %s of user %s.", s->id, s->user->name);
+ log_struct(s->type == SESSION_TTY || s->type == SESSION_X11 ? LOG_INFO : LOG_DEBUG,
+ "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SESSION_START),
+ "SESSION_ID=%s", s->id,
+ "USER_ID=%s", s->user->name,
+ "LEADER=%lu", (unsigned long) s->leader,
+ "MESSAGE=New session %s of user %s.", s->id, s->user->name,
+ NULL);
/* Create cgroup */
r = session_create_cgroup(s);
@@ -679,8 +686,13 @@ int session_stop(Session *s) {
assert(s);
if (s->started)
- log_full(s->type == SESSION_TTY || s->type == SESSION_X11 ? LOG_INFO : LOG_DEBUG,
- "Removed session %s.", s->id);
+ log_struct(s->type == SESSION_TTY || s->type == SESSION_X11 ? LOG_INFO : LOG_DEBUG,
+ "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SESSION_STOP),
+ "SESSION_ID=%s", s->id,
+ "USER_ID=%s", s->user->name,
+ "LEADER=%lu", (unsigned long) s->leader,
+ "MESSAGE=Removed session %s.", s->id,
+ NULL);
/* Kill cgroup */
k = session_terminate_cgroup(s);