source:
trunk/server/common/patches/httpd-suexec-journald.patch
@
2717
Last change on this file since 2717 was 2603, checked in by achernya, 10 years ago | |
---|---|
File size: 2.9 KB |
-
support/Makefile.in
From 7eefa90ac1422825db6f1bbbe4e66f1336fca531 Mon Sep 17 00:00:00 2001 From: Alexander Chernyakhovsky <achernya@mit.edu> Date: Thu, 28 Aug 2014 22:51:21 -0400 Subject: [PATCH] Redirect stderr to systemd-journald Scripts provides the "logview" facility for users to be able to see the error logs from their applications. However, this facility requires running the moral equivalent of grep $USER error_log. Not all error messages contain the username, and therefore, the logview facility is unreliable at best. Additionally, the error_log contains an interleaving of all errors, which makes it difficult for system administrators to help withs upport requests in which an Internal Server Error has been experienced. Since systemd-journald supports per-user journals, replace stderr, which is provided by Apache, with a file descriptor pointing to the journal. Assuming that journald is configured to split the log on UIDs, this will allow journalctl --user to show each individual user their error logs. --- support/Makefile.in | 7 ++++++- support/suexec.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/support/Makefile.in b/support/Makefile.in index 745d86c..4014c1f 100644
a b checkgid: $(checkgid_OBJECTS) 73 73 $(LINK) $(checkgid_LTFLAGS) $(checkgid_OBJECTS) $(PROGRAM_LDADD) 74 74 75 75 suexec_OBJECTS = suexec.lo 76 suexec_LDADD = "-lsystemd-journal -lsystemd-id128" 77 suexec.lo: suexec.c 78 $(LIBTOOL) --mode=compile $(CC) $(ab_CFLAGS) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ 79 $(ALL_INCLUDES) $(PICFLAGS) $(LTCFLAGS) -DSCRIPTS_HAVE_SYSTEMD_JOURNAL \ 80 -c $< && touch $@ 76 81 suexec: $(suexec_OBJECTS) 77 $(LINK) $(suexec_OBJECTS) 82 $(LINK) $(suexec_OBJECTS) $(suexec_LDADD) 78 83 79 84 htcacheclean_OBJECTS = htcacheclean.lo 80 85 htcacheclean: $(htcacheclean_OBJECTS) -
support/suexec.c
diff --git a/support/suexec.c b/support/suexec.c index 3a4d802..4fe4c44 100644
a b 61 61 #include <grp.h> 62 62 #endif 63 63 64 #ifdef SCRIPTS_HAVE_SYSTEMD_JOURNAL 65 #include <systemd/sd-journal.h> 66 #include <systemd/sd-daemon.h> 67 #endif 68 64 69 #ifdef AP_LOG_SYSLOG 65 70 #include <syslog.h> 66 71 #endif … … TRUSTED_DIRECTORY: 769 774 umask(AP_SUEXEC_UMASK); 770 775 #endif /* AP_SUEXEC_UMASK */ 771 776 777 #ifdef SCRIPTS_HAVE_SYSTEMD_JOURNAL 778 int fd = sd_journal_stream_fd("CGI Script", LOG_NOTICE, 0); 779 if (fd < 0) { 780 log_err("unable to open systemd-journald file descriptor\n"); 781 exit(254); 782 } 783 if (dup2(fd, STDERR_FILENO) < 0) { 784 log_err("unable to make journald file descriptor available as stderr\n"); 785 exit(253); 786 } 787 if (close(fd) < 0) { 788 log_err("unable to close journald file descriptor copy\n"); 789 exit(252); 790 } 791 #endif /* SCRIPTS_HAVE_SYSTEMD_JOURNAL */ 792 772 793 /* Be sure to close the log file so the CGI can't mess with it. */ 773 794 #ifdef AP_LOG_SYSLOG 774 795 if (log_open) {
Note: See TracBrowser
for help on using the repository browser.