[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
svn/tags/lighttpd-1.4.33
Stefan Bühler 9 years ago
parent f0e5b84c27
commit c26b0f9617
  1. 1
      NEWS
  2. 9
      src/mod_accesslog.c

@ -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)

@ -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) {

Loading…
Cancel
Save