chiark / gitweb /
logind: log with AUTH facility
authorLennart Poettering <lennart@poettering.net>
Tue, 3 Apr 2012 17:25:29 +0000 (19:25 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 3 Apr 2012 17:26:02 +0000 (19:26 +0200)
TODO
src/journal/journald.c
src/log.c
src/log.h
src/login/logind.c

diff --git a/TODO b/TODO
index 6f7679f235b3ba31a727e0ded22659da45ff661a..4f3b157040c0515152fe1ea979f3c7151241fdc3 100644 (file)
--- a/TODO
+++ b/TODO
@@ -30,8 +30,6 @@ Features:
 
 * dbus upstream still refers to dbus.target and shouldn't
 
 
 * dbus upstream still refers to dbus.target and shouldn't
 
-* ensure that logind sets the syslog facility to AUTH when logging
-
 * when a service has the same env var set twice we actually store it twice and return that in systemctl show -p... We should only show the last setting
 
 * add man page documenting all kernel cmdline options, including stuff like fsck.mode=
 * when a service has the same env var set twice we actually store it twice and return that in systemctl show -p... We should only show the last setting
 
 * add man page documenting all kernel cmdline options, including stuff like fsck.mode=
index f341b8742b038498891ef95d698a0e4d891d5e7c..555d74f04985c911fe0c77262561118d26642a9a 100644 (file)
@@ -2765,6 +2765,7 @@ int main(int argc, char *argv[]) {
         }
 
         log_set_target(LOG_TARGET_CONSOLE);
         }
 
         log_set_target(LOG_TARGET_CONSOLE);
+        log_set_facility(LOG_SYSLOG);
         log_parse_environment();
         log_open();
 
         log_parse_environment();
         log_open();
 
index 5b1721184e65362a5e2f119ee90d127ac98c0c9d..9fffc1dbc00ba2123cae35afbf3d4eb0156865eb 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -37,6 +37,7 @@
 
 static LogTarget log_target = LOG_TARGET_CONSOLE;
 static int log_max_level = LOG_INFO;
 
 static LogTarget log_target = LOG_TARGET_CONSOLE;
 static int log_max_level = LOG_INFO;
+static int log_facility = LOG_DAEMON;
 
 static int console_fd = STDERR_FILENO;
 static int syslog_fd = -1;
 
 static int console_fd = STDERR_FILENO;
 static int syslog_fd = -1;
@@ -310,6 +311,10 @@ void log_set_max_level(int level) {
         log_max_level = level;
 }
 
         log_max_level = level;
 }
 
+void log_set_facility(int facility) {
+        log_facility = facility;
+}
+
 static int write_to_console(
                 int level,
                 const char*file,
 static int write_to_console(
                 int level,
                 const char*file,
@@ -457,11 +462,13 @@ static int write_to_journal(
 
         snprintf(header, sizeof(header),
                  "PRIORITY=%i\n"
 
         snprintf(header, sizeof(header),
                  "PRIORITY=%i\n"
+                 "SYSLOG_FACILITY=%i\n"
                  "CODE_FILE=%s\n"
                  "CODE_LINE=%i\n"
                  "CODE_FUNCTION=%s\n"
                  "MESSAGE=",
                  LOG_PRI(level),
                  "CODE_FILE=%s\n"
                  "CODE_LINE=%i\n"
                  "CODE_FUNCTION=%s\n"
                  "MESSAGE=",
                  LOG_PRI(level),
+                 LOG_FAC(level),
                  file,
                  line,
                  func);
                  file,
                  line,
                  func);
@@ -497,7 +504,7 @@ static int log_dispatch(
 
         /* Patch in LOG_DAEMON facility if necessary */
         if ((level & LOG_FACMASK) == 0)
 
         /* Patch in LOG_DAEMON facility if necessary */
         if ((level & LOG_FACMASK) == 0)
-                level = LOG_DAEMON | LOG_PRI(level);
+                level = log_facility | LOG_PRI(level);
 
         do {
                 char *e;
 
         do {
                 char *e;
index 5c6310ef149b4799ea1e2fbd9551a654207d664e..3283808ff88cbdc3c201d06a96693e598cc4c94b 100644 (file)
--- a/src/log.h
+++ b/src/log.h
@@ -43,6 +43,7 @@ typedef enum LogTarget{
 
 void log_set_target(LogTarget target);
 void log_set_max_level(int level);
 
 void log_set_target(LogTarget target);
 void log_set_max_level(int level);
+void log_set_facility(int facility);
 
 int log_set_target_from_string(const char *e);
 int log_set_max_level_from_string(const char *e);
 
 int log_set_target_from_string(const char *e);
 int log_set_max_level_from_string(const char *e);
index 777d91252afe93a4e137a7bbfc205a586bf949eb..a54195cebb6d578ab343302090bad343630e6430 100644 (file)
@@ -1240,6 +1240,7 @@ int main(int argc, char *argv[]) {
         int r;
 
         log_set_target(LOG_TARGET_AUTO);
         int r;
 
         log_set_target(LOG_TARGET_AUTO);
+        log_set_facility(LOG_AUTH);
         log_parse_environment();
         log_open();
 
         log_parse_environment();
         log_open();