DeveloperSide.NET Forums
December 06, 2019, 12:51:36 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1] 2
  Print  
Author Topic: multiple log lines  (Read 16995 times)
0 Members and 2 Guests are viewing this topic.
portland
Jr. Member
**
Posts: 32


View Profile
« on: March 05, 2007, 09:03:05 PM »

Very confusingly, each request to the server results in more than one line being written to the log file. 

It appears that having multiple CustomLog lines results in multiple loggings.  So, having the 4 lines below in any .conf file will add 4 lines to the log.  Is this per design?

CustomLog logs/access.log common
CustomLog logs/access.log common
CustomLog logs/access.log common
CustomLog logs/access.log common

Since httpd.conf and mod_deflate_logio.conf are both loaded by default, this always results in at least twice the amount of loglines I need.

Hm...
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #1 on: March 05, 2007, 09:05:27 PM »

You should only have one per virtual host, and only one under the main config.

If you are logging the same info twice, something is a bit off under your config.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
portland
Jr. Member
**
Posts: 32


View Profile
« Reply #2 on: March 06, 2007, 08:33:10 AM »

You should only have one (CustomLog) per virtual host, and only one under the main config.

Right, and that's where the problem may be.  In both httpd.conf and mod_deflate_logio.conf the CustomLog statement appears, resulting in two lines to the same access.log for every access to the main server.

When a virtual host is accessed however, the CustomLog entries for both logio_module and deflate_module do not appear at all.

I thought mod_deflate_logio.conf was a global thing, but apparently it isn't.  That confuses me.

Is that how it is supposed to be?
« Last Edit: March 06, 2007, 09:15:53 AM by portland » Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #3 on: March 06, 2007, 02:23:48 PM »

Its been a while, but I think that the CustomLog entry under mod_deflate_logio.conf was designed to override the 'CustomLog logs/access.log combined' entry under the 'global' httpd.conf part -- if the logio module is loaded.

I checked my own local logs, and you are right, everything is getting logged twice... Not sure how I missed that one.

I'm not possitive if putting a '<IfModule !logio_module>' around the main CustomLog would work, as that module is loaded latter on. I guess that would depend on how Apache parses and orders the config file.

And I think under VHs, if no log is specified, everything goes into the main logs.
« Last Edit: March 06, 2007, 02:27:13 PM by admin » Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
portland
Jr. Member
**
Posts: 32


View Profile
« Reply #4 on: March 06, 2007, 02:42:45 PM »

The other thing is that virtual host output does not get deflated.  Does that make sense to you?
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #5 on: March 06, 2007, 02:49:54 PM »

Are you sure? Under my deflate.log the VH entries appear to be getting filtered through mod_deflate.
« Last Edit: March 06, 2007, 03:12:34 PM by admin » Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #6 on: March 06, 2007, 03:31:19 PM »

I went ahead and removed the log part from httpd.conf and placed everything under mod_deflate_logio.conf...
Code:
LoadModule logio_module modules/mod_logio.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so

<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-agent}i\"" combinedtrueout
CustomLog logs/access.log combinedtrueout
</IfModule>

<IfModule !logio_module>
CustomLog logs/access.log combined
</IfModule>
...
« Last Edit: March 06, 2007, 03:39:49 PM by admin » Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
portland
Jr. Member
**
Posts: 32


View Profile
« Reply #7 on: March 06, 2007, 03:45:16 PM »

Thanks, that will help. 

As for not deflating vh output: I'm not as sure as I thought I was.  It seems to work properly now.  Could be my log file monitoring thing overlooked deflate.log.  It has a quirk or two.
« Last Edit: March 06, 2007, 03:48:13 PM by portland » Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #8 on: March 06, 2007, 03:49:32 PM »

No dependency that I can think of right now.

Its a bit of a toss-up of whether this should go under httpd.conf or its own config include. I'll think about it.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
portland
Jr. Member
**
Posts: 32


View Profile
« Reply #9 on: March 06, 2007, 03:51:52 PM »

Sorry, messages got crossed.  I edited the text you responded to. 

The dependency I thought of was taken care of in your default conf already, so that is not an issue.  My mistake.
Logged
portland
Jr. Member
**
Posts: 32


View Profile
« Reply #10 on: March 06, 2007, 04:32:23 PM »

I think it should be done yet another way.  Doing it the way you propose will result in lines in access.log even when virtual hosts are accessed, causing confusion.

I went back to the default conf but with CustomLog logs/access_deflated.log combinedtrueout.  So now ALL logio_module logging is to deflate.log and access_deflated.log.

In time I think I will stop logging to access_deflated as it obviously works and does not tell me much that cannot be read in other logs.

I don't know if this is the best way, but I think it will work for me.
Logged
portland
Jr. Member
**
Posts: 32


View Profile
« Reply #11 on: March 08, 2007, 11:24:12 AM »

I think you may have missed a few places where <IfModule log_config_module> should be inserted.  I tried running with mod_log_config disabled and the errors came out.

In httpd-ssl.conf there are 2 places where it should be added. 

Also (in httpd-ssl.conf), why is there TransferLog logs/access_ssl.log instead of a CustomLog?  I'm not saying it is wrong, but if there is a rationale I don't understand it.  Lack of knowledge on my part, I'm sure.
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #12 on: March 08, 2007, 02:37:19 PM »

httpd.conf and components seem to be clear, its just a problem under httpd-ssl.conf. [Install Apache Service without -DSSL and it will run]

TransferLog is used under "<VirtualHost _default_:443>", because TransferLog either uses the last defined LogFormat [in this case none exist for that VH], or defaults to the Common Log Format.
http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#transferlog

So it basically has the effect of "CustomLog logs/access_ssl.log common" [without having to define "common"].

I suppose since this context is "_default_", I just left it like that. I would need to clean up that file and get rid of the comments, before I would start making changes.

BTW, I never really expected anyone to run without the log module.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
portland
Jr. Member
**
Posts: 32


View Profile
« Reply #13 on: March 08, 2007, 03:08:19 PM »

No, I don't plan to run without a log module either.  I disabled it to confirm that the ssl logging would in fact cause an error.  It just was meant to prove the inconsistency in not using the <IfModule log_config_module> thing in ssl.conf.

If you REALLY mean that nobody should ever run without logging, all <IfModule log_config_module> can be removed everywhere.  That would clean things up a bit.

BTW is there an error log anywhere that explains what went wrong when a config error is encountered during Apache startup?
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #14 on: March 08, 2007, 03:29:21 PM »

Depending on the error, you might be able to see it under logs/error.log, or via starting, or installing, Apache from the command line. For syntax problems there is also 'httpd -t', but it will not work in this case. There is also 'httpd -e debug' which can provide more info. It depends on the error and situation.

Quote
C:\>httpd -DSSL -k install
Installing the Apache2 service
The Apache2 service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
Syntax error on line 81 of C:/www/Apache22/conf/extra/httpd-ssl.conf:
Invalid command 'TransferLog', perhaps misspelled or defined by a module not included in the server configuration

Quote
C:\>httpd -t
Syntax OK

Quote
C:\>httpd -k start
Syntax error on line 81 of C:/www/Apache22/conf/extra/httpd-ssl.conf:
Invalid command 'TransferLog', perhaps misspelled or defined by a module not included in the server configuration
« Last Edit: March 08, 2007, 03:34:32 PM by admin » Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!