summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2013-08-30 14:13:43 +0000
committerstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2013-08-30 14:13:43 +0000
commit83d4a0f189fde51f3b19c1e90a391d69c0702cac (patch)
tree950332cdfe8f673fc73f5956e7d681a08de1db32
parent82487d7bd8986c5aa7f5ae4158cbda2c85ab3dc9 (diff)
downloadlighttpd-83d4a0f189fde51f3b19c1e90a391d69c0702cac.tar.gz
[mod_accesslog] add accesslog.syslog-level option (fixes #2480)
From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2899 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--NEWS1
-rw-r--r--src/mod_accesslog.c9
2 files changed, 9 insertions, 1 deletions
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) {