Project

General

Profile

Bug #1064

syslog messages in conditional section not working properly

Added by Anonymous over 13 years ago. Updated over 13 years ago.

Status:
Fixed
Priority:
High
Category:
mod_accesslog
Target version:
-
ASK QUESTIONS IN Forums:

Description

I'm trying to set up syslog logging and run into a interesting problem:

my configuration is similar to:


accesslog.format = "%h %V %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" 
accesslog.use-syslog = "disable" 

$HTTP["host"] == "mobile.hotornot.de" {
  server.document-root          = "/document/root/" 
  accesslog.use-syslog = "enable" 
}

I'm expecting syslog messages only for hits in this particular subdomain.
Instead I receive single messages which contain concatenated hits from other subdomains. the message ends always with an hit from mobile.hotornot.de


Mar  2 11:19:07 192.168.1.12 lighttpd[23620]: 217.94.245.15 pix2.hotornot.de [02/Mar/2007:11:19:07 +0100] "GET 
/g/neu/table_head_login.gif HTTP/1.1" 200 510 "http://www.hotornot.de/login.php" "Mozilla/5.0 (X11; U; Linux i6
86; en-US; rv:1.8.1.2) Gecko/20061201 Firefox/2.0.0.2 (Ubuntu-feisty)" 85.205.222.137 mobile.hotornot.de [02/Mar/2007:11:19:07 +0100] "GET /viz/voting.php?g=w HTTP/1.0" 200 2207 "-" "NokiaN73-1/3.0638.0.0.1 Series60/3.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Link/6.3.0.0.0" 

This example shows 2 hits in one syslog message. I found messages with alot more Hits per message.

-- j.prieser

#1

Updated by Anonymous over 13 years ago

I've found ticket #727 which describes the same symptom.
Problem aren't newlines but the matched condition.

-- j.prieser

#2

Updated by Anonymous over 13 years ago

I found the problem.
The Buffer gets filled in log_access_write() on every request and only reset after writing. Requests with disabled accesslog (because of config condition) still append to the buffer.

I've added the following lines after http://trac.lighttpd.net/trac/browser/trunk/src/mod_accesslog.c#L635
and now it works.


if (p->conf.use_syslog ||  /* syslog doesn't cache */
        (p->conf.access_logfile->used && p->conf.access_logfile->ptr[0] != '|') || /* pipes don't cache */
        newts ||
        b->used > BUFFER_MAX_REUSE_SIZE) {
        buffer_reset(b);
    }

-- j.prieser

#3

Updated by jan over 13 years ago

  • Status changed from New to Fixed
  • Resolution set to fixed

fixed in r1729

Also available in: Atom