logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Changing internet log file format
Author
BRG14



Joined: 28 Feb 2008
Posts: 3

PostPosted: Thu 28 Feb '08 18:20    Post subject: Changing internet log file format Reply with quote

Hi,

New to the site and very new to Apache (as a matter of fact I don't know anything!)

I need to find this out for someone else... what would be required to change an internet log file format on an Apache server?

2 log file formats need to be changed.

The first is an error log, the format is as follows:
host, - , - , timestamp, method url, status code, file size(bytes)

All that needs to be tacked onto the end is referer and user agent, which would make the format look like this:

host, - , - , timestamp, method url, status code, file size(bytes), referer, User agent with format: "Mozilla/4.0 (compatible, ...)"


The second is a request log, the format is as follows:
timestamp, host, -, -, method url, file size(bytes)

and needs to be changed to:
host, -, -, timestamp, method url, status code, doc size (bytes), referer, user agent


Basically we just need the command and syntax that would change an internet log file format. Any help would be greatly appreciated.

Thank you!
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Thu 28 Feb '08 18:23    Post subject: Reply with quote

Please consult the docs there is a part about log config

If you still have a question, please ask again
Back to top
BRG14



Joined: 28 Feb 2008
Posts: 3

PostPosted: Thu 28 Feb '08 18:30    Post subject: Reply with quote

James Blond wrote:
Please consult the docs there is a part about log config

If you still have a question, please ask again


Thank you!

Sorry for being the typical ignorant first time poster!
Back to top
BRG14



Joined: 28 Feb 2008
Posts: 3

PostPosted: Thu 28 Feb '08 18:42    Post subject: Reply with quote

James Blond wrote:
Please consult the docs there is a part about log config

If you still have a question, please ask again


Ok... 1 more quick question. What would be the format string for the referer page (ex. "https://webapp.dev.blah.blahblah.com/app/") and user agent (ex. "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2)")
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Thu 28 Feb '08 22:41    Post subject: Reply with quote

Code:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog /server2/logs/access.log combined


See http://httpd.apache.org/docs/2.2/mod/mod_log_config.html for the details Wink
Back to top


Reply to topic   Topic: Changing internet log file format View previous topic :: View next topic
Post new topic   Forum Index -> Apache