From 83d4a0f189fde51f3b19c1e90a391d69c0702cac Mon Sep 17 00:00:00 2001 From: stbuehler Date: Fri, 30 Aug 2013 14:13:43 +0000 Subject: [mod_accesslog] add accesslog.syslog-level option (fixes #2480) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Stefan Bühler git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2899 152afb58-edef-0310-8abb-c4023f1b3aa9 --- NEWS | 1 + src/mod_accesslog.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c0dd7155..df6652fd 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ NEWS * [core] remove requirement that default doc-root has to exist, there are reasonable scenarios not requiring static files at all * [core] check whether server.chroot exists * [mod_simple_vhost] fix cache; skip module if simple-vhost.server-root is empty (thx rm for reporting) + * [mod_accesslog] add accesslog.syslog-level option (fixes #2480) - 1.4.32 - 2012-11-21 * Code cleanup with clang/sparse (fixes #2437, thx kibi) diff --git a/src/mod_accesslog.c b/src/mod_accesslog.c index 9df0e4e7..5484f551 100644 --- a/src/mod_accesslog.c +++ b/src/mod_accesslog.c @@ -128,6 +128,7 @@ typedef struct { buffer *access_logbuffer; /* each logfile has a separate buffer */ unsigned short use_syslog; /* syslog has global buffer */ + unsigned short syslog_level; buffer *format; @@ -459,6 +460,7 @@ SETDEFAULTS_FUNC(log_access_open) { { "accesslog.filename", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, { "accesslog.use-syslog", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, { "accesslog.format", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, + { "accesslog.syslog-level", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } }; @@ -478,11 +480,13 @@ SETDEFAULTS_FUNC(log_access_open) { s->log_access_fd = -1; s->last_generated_accesslog_ts = 0; s->last_generated_accesslog_ts_ptr = &(s->last_generated_accesslog_ts); + s->syslog_level = LOG_INFO; cv[0].destination = s->access_logfile; cv[1].destination = &(s->use_syslog); cv[2].destination = s->format; + cv[3].destination = &(s->syslog_level); p->config_storage[i] = s; @@ -633,6 +637,7 @@ static int mod_accesslog_patch_connection(server *srv, connection *con, plugin_d PATCH(append_tz_offset); PATCH(parsed_format); PATCH(use_syslog); + PATCH(syslog_level); /* skip the first, the global context */ for (i = 1; i < srv->config_context->used; i++) { @@ -659,6 +664,8 @@ static int mod_accesslog_patch_connection(server *srv, connection *con, plugin_d PATCH(append_tz_offset); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("accesslog.use-syslog"))) { PATCH(use_syslog); + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("accesslog.syslog-level"))) { + PATCH(syslog_level); } } } @@ -906,7 +913,7 @@ REQUESTDONE_FUNC(log_access_write) { #ifdef HAVE_SYSLOG_H if (b->used > 2) { /* syslog appends a \n on its own */ - syslog(LOG_INFO, "%*s", (int) b->used - 2, b->ptr); + syslog(p->conf.syslog_level, "%*s", (int) b->used - 2, b->ptr); } #endif } else if (p->conf.log_access_fd != -1) { -- cgit v1.2.1