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