0e3136
diff --git a/modules/loggers/config.m4 b/modules/loggers/config.m4
0e3136
index 762e773..0848d2e 100644
0e3136
--- a/modules/loggers/config.m4
0e3136
+++ b/modules/loggers/config.m4
0e3136
@@ -5,6 +5,8 @@ dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
0e3136
 APACHE_MODPATH_INIT(loggers)
0e3136
 	
0e3136
 APACHE_MODULE(log_config, logging configuration.  You won't be able to log requests to the server without this module., , , yes)
0e3136
+APR_ADDTO(MOD_LOG_CONFIG_LDADD, [$SYSTEMD_LIBS])
0e3136
+
0e3136
 APACHE_MODULE(log_debug, configurable debug logging, , , most)
0e3136
 APACHE_MODULE(log_forensic, forensic logging)
0e3136
 
0e3136
diff --git a/modules/loggers/mod_log_config.c b/modules/loggers/mod_log_config.c
0e3136
index 996c09c..50a056a 100644
0e3136
--- a/modules/loggers/mod_log_config.c
0e3136
+++ b/modules/loggers/mod_log_config.c
0e3136
@@ -172,6 +172,10 @@
0e3136
 #include <limits.h>
0e3136
 #endif
0e3136
 
0e3136
+#ifdef HAVE_SYSTEMD
0e3136
+#include <systemd/sd-journal.h>
0e3136
+#endif
0e3136
+
0e3136
 #define DEFAULT_LOG_FORMAT "%h %l %u %t \"%r\" %>s %b"
0e3136
 
0e3136
 module AP_MODULE_DECLARE_DATA log_config_module;
0e3136
@@ -1638,6 +1642,25 @@ static apr_status_t ap_default_log_writer( request_rec *r,
0e3136
 
0e3136
     return rv;
0e3136
 }
0e3136
+
0e3136
+static apr_status_t wrap_journal_stream(apr_pool_t *p, apr_file_t **outfd,
0e3136
+                                        int priority)
0e3136
+{
0e3136
+#ifdef HAVE_SYSTEMD
0e3136
+    int fd;
0e3136
+
0e3136
+    fd = sd_journal_stream_fd("httpd", priority, 0);
0e3136
+    if (fd < 0) return fd;
0e3136
+
0e3136
+    /* This is an AF_UNIX socket fd so is more pipe-like than
0e3136
+     * file-like (the fd is neither seekable or readable), and use of
0e3136
+     * apr_os_pipe_put_ex() allows cleanup registration. */
0e3136
+    return apr_os_pipe_put_ex(outfd, &fd, 1, p);
0e3136
+#else
0e3136
+    return APR_ENOTIMPL;
0e3136
+#endif
0e3136
+}
0e3136
+
0e3136
 static void *ap_default_log_writer_init(apr_pool_t *p, server_rec *s,
0e3136
                                         const char* name)
0e3136
 {
0e3136
@@ -1650,6 +1673,32 @@ static void *ap_default_log_writer_init(apr_pool_t *p, server_rec *s,
0e3136
         }
0e3136
         return ap_piped_log_write_fd(pl);
0e3136
     }
0e3136
+    else if (strncasecmp(name, "journald:", 9) == 0) {
0e3136
+        int priority;
0e3136
+        const char *err = ap_parse_log_level(name + 9, &priority);
0e3136
+        apr_status_t rv;
0e3136
+        apr_file_t *fd;
0e3136
+
0e3136
+        if (err == NULL && priority > LOG_DEBUG) {
0e3136
+            err = "TRACE level debugging not supported with journald";
0e3136
+        }
0e3136
+
0e3136
+        if (err) {
0e3136
+            ap_log_error(APLOG_MARK, APLOG_ERR, APR_EBADPATH, s, 
0e3136
+                         "invalid journald log priority name %s: %s",
0e3136
+                         name, err);
0e3136
+            return NULL;
0e3136
+        }
0e3136
+
0e3136
+        rv = wrap_journal_stream(p, &fd, priority);
0e3136
+        if (rv) {
0e3136
+            ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, 
0e3136
+                         "could not open journald log stream");
0e3136
+            return NULL;
0e3136
+        }
0e3136
+
0e3136
+        return fd;
0e3136
+    }
0e3136
     else {
0e3136
         const char *fname = ap_server_root_relative(p, name);
0e3136
         apr_file_t *fd;