LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-09-2024, 11:59 AM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,564

Rep: Reputation: 177Reputation: 177
Confused about httpd log format and files


I have the following configured in my httpd.conf (comments removed):
Code:
LogLevel warn

<IfModule log_config_module>
    LogFormat "%{%Y-%m-%d %H:%M:%S}t %h %>s %B \"%{User-Agent}i\" \"%m %U%q\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    
    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
      
    CustomLog "/var/log/httpd/access_log" common
      
</IfModule>
First of all, what are the various qualifiers "combined", "common" and "combindeio"? I don't understand these.

More inportantly, I want the format shown that I've highlighted -- I've used this elsewhere, instead in access_log I get what appears to be the format beneath it:
Code:
87.236.176.2 - - [09/Mar/2024:12:48:14 -0500] "GET / HTTP/1.1" 200 4723
If I comment out that one (right after the highlight) I get lines of the word "common":
Code:
209.97.152.248 - - [09/Mar/2024:12:50:03 -0500] "GET /images/favicon.ico HTTP/1.1" 200 5430 (<-- before changing LogFormat)
common (<-- after changing LogFormat)
common
common
common
What do I need to do to get the highlighted format working?
 
Old 03-09-2024, 12:35 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,660

Rep: Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708
Might one presume this is the Apache HTTPD?
And if so, that it is the version from the current SLACKWARE sets?
 
Old 03-09-2024, 08:39 PM   #3
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,337
Blog Entries: 28

Rep: Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144
If it is indeed Apache (as "httpd" leads me to believe), this article may be helpful.
 
Old 03-09-2024, 11:00 PM   #4
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,660

Rep: Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708
FYI: I have used 5 different HTTPD servers, and I am sure I have not used all of the ones that exist. The Apache HTTPD is only the best known right now.
The NCSA HTTPd server came first, and the early Apache HTTPD server was based upon that.
 
Old 03-10-2024, 10:58 PM   #5
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 783

Rep: Reputation: 250Reputation: 250Reputation: 250
Quote:
First of all, what are the various qualifiers "combined", "common" and "combindeio"?
As per the docs (which in a basic Apache install land in /manual/logs.html in your webroot), "This defines the nickname common and associates it with a particular log format string." According to that, you likely want the line to be

Code:
CustomLog "/var/log/httpd/access_log" combined
which is what I use right now. They are defining log formats, and when you comment it out you remove the definition.
 
1 members found this post helpful.
Old 03-11-2024, 12:57 AM   #6
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,564

Original Poster
Rep: Reputation: 177Reputation: 177
Quote:
Originally Posted by wpeckham View Post
Might one presume this is the Apache HTTPD?
And if so, that it is the version from the current SLACKWARE sets?
Yes Apache httpd. Slackware 15.0, not Current.
Quote:
Originally Posted by jayjwa View Post
As per the docs (which in a basic Apache install land in /manual/logs.html in your webroot), "This defines the nickname common and associates it with a particular log format string." According to that, you likely want the line to be

Code:
CustomLog "/var/log/httpd/access_log" combined
which is what I use right now. They are defining log formats, and when you comment it out you remove the definition.
That worked! The CustomLog for common was not commented out, but the log format I wanted specified combined. I changed that to
Code:
LogFormat "%{%Y-%m-%d %H:%M:%S}t %h %>s %B \"%{User-Agent}i\" \"%m %U%q\"" common
And it started logging what I wanted. Thanks.

(Still not sure of what the various common, combined, and combinedio nicknames do, but maybe those don't apply in my case.)

Last edited by mfoley; 03-11-2024 at 01:16 AM.
 
Old 03-11-2024, 04:51 AM   #7
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
You should leave the log format definitions alone and specify which one you want to use in the vhost definition, as in jayjwa's post.

It seems you have 'common' specified when you want 'combined'.
 
Old 03-11-2024, 09:44 PM   #8
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,564

Original Poster
Rep: Reputation: 177Reputation: 177
Quote:
Originally Posted by descendant_command View Post
You should leave the log format definitions alone and specify which one you want to use in the vhost definition, as in jayjwa's post.

It seems you have 'common' specified when you want 'combined'.
As long as your suggesting ... Why would I want 'combined' versus 'common'? What exactly is the difference/purpose of combined versus common versus combindeio? Are there designates purposes for each of these "aliases"? Is "combined" the normal/standard one to used? Combined with what? I find this aspect of http logs quite confusing if they all end up in access_log anyway. The docs don't really this clarify for me.
 
Old 03-12-2024, 06:37 AM   #9
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
No idea where they originate, you could label them barry, dave or short, if you want.

My point is that the httpd.conf contains the format definition, specifying the layout and an arbitrary label for it, which you can then call by label in each vhost without having to recreate the format template all over again.

Pick one that matches what you want to see in your logs, or make your own.

Last edited by descendant_command; 03-12-2024 at 06:39 AM.
 
  


Reply

Tags
httpdconf, log



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to log internal-sftp chroot jailed users access log to /var/log/sftp.log file LittleMaster Linux - Server 0 09-04-2018 03:45 PM
httpd: Syntax error on line 210 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 iswarya Linux - Newbie 1 01-25-2012 01:28 PM
kernel log format in /var/log/kern.log sinu_nayak2001 Linux - Newbie 2 10-07-2009 08:34 AM
In Apache server, How to change log file location and log format for access log fil? since1993 Linux - Server 1 08-19-2009 04:14 PM
Starting httpd: httpd: Syntax error on line 209 of /etc/httpd/conf/httpd.conf: Syntax sethukpathi Linux - Networking 6 04-12-2008 11:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration