Skip to content

Commit

Permalink
journal: add minimal journal gateway daemon based on GNU libmicrohttpd
Browse files Browse the repository at this point in the history
This minimal HTTP server can serve journal data via HTTP. Its primary
purpose is synchronization of journal data across the network. It serves
journal data in three formats:

       text/plain: the text format known from /var/log/messages
       application/json: the journal entries formatted as JSON
       application/vnd.fdo.journal: the binary export format of the journal

The HTTP server also serves a small HTML5 app that makes use of the JSON
serialization to present the journal data to the user.

Examples:

This downloads the journal in text format:

 # systemctl start systemd-journal-gatewayd.service
 # wget http://localhost:19531/entries

Same for JSON:

 # curl -H"Accept: application/json" http://localhost:19531/entries

Access via web browser:

 $ firefox http://localhost:19531/
  • Loading branch information
poettering committed Sep 27, 2012
1 parent be3ea5e commit 7b17a7d
Show file tree
Hide file tree
Showing 8 changed files with 710 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/install-tree
/systemd-journal-gatewayd
/test-mmap-cache
/test-unit-file
/test-log
Expand Down
37 changes: 37 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2651,6 +2651,43 @@ EXTRA_DIST += \
CLEANFILES += \
src/journal/journald-gperf.c

if HAVE_MICROHTTPD

gatewayddocumentrootdir=$(pkgdatadir)/gatewayd

rootlibexec_PROGRAMS += \
systemd-journal-gatewayd

systemd_journal_gatewayd_SOURCES = \
src/journal/journal-gatewayd.c

systemd_journal_gatewayd_LDADD = \
libsystemd-shared.la \
libsystemd-logs.la \
libsystemd-journal-internal.la \
libsystemd-id128-internal.la \
libsystemd-daemon.la \
$(MICROHTTPD_LIBS)

systemd_journal_gatewayd_CFLAGS = \
-DDOCUMENT_ROOT=\"$(gatewayddocumentrootdir)\" \
$(AM_CFLAGS) \
$(MICROHTTPD_CFLAGS)

EXTRA_DIST += \
units/systemd-journal-gatewayd.service.in

dist_systemunit_DATA += \
units/systemd-journal-gatewayd.socket

nodist_systemunit_DATA += \
units/systemd-journal-gatewayd.service

dist_gatewayddocumentroot_DATA = \
src/journal/browse.html

endif

# ------------------------------------------------------------------------------
if ENABLE_COREDUMP
systemd_coredump_SOURCES = \
Expand Down
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ REQUIREMENTS:
libselinux (optional)
liblzma (optional)
tcpwrappers (optional)
libgcrypt (optional)
libqrencode (optional)
libmicrohttpd (optional)

When you build from git you need the following additional dependencies:

Expand Down
13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,18 @@ if test "x$enable_qrencode" != "xno"; then
fi
AM_CONDITIONAL(HAVE_QRENCODE, [test "$have_qrencode" = "yes"])

# ------------------------------------------------------------------------------
have_microhttpd=no
AC_ARG_ENABLE(microhttpd, AS_HELP_STRING([--disable-microhttpd], [disable microhttpd support]))
if test "x$enable_microhttpd" != "xno"; then
PKG_CHECK_MODULES(MICROHTTPD, [ libmicrohttpd ],
[AC_DEFINE(HAVE_MICROHTTPD, 1, [Define if microhttpd is available]) have_microhttpd=yes], have_microhttpd=no)
if test "x$have_microhttpd" = xno -a "x$enable_microhttpd" = xyes; then
AC_MSG_ERROR([*** microhttpd support requested but libraries not found])
fi
fi
AM_CONDITIONAL(HAVE_MICROHTTPD, [test "$have_microhttpd" = "yes"])

# ------------------------------------------------------------------------------
have_binfmt=no
AC_ARG_ENABLE(binfmt, AS_HELP_STRING([--disable-binfmt], [disable binfmt tool]))
Expand Down Expand Up @@ -803,6 +815,7 @@ AC_MSG_RESULT([
ACL: ${have_acl}
GCRYPT: ${have_gcrypt}
QRENCODE: ${have_qrencode}
MICROHTTPD: ${have_microhttpd}
binfmt: ${have_binfmt}
vconsole: ${have_vconsole}
readahead: ${have_readahead}
Expand Down
Loading

0 comments on commit 7b17a7d

Please sign in to comment.