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 -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: exclude from logs based on status code
Author
putter1900



Joined: 22 Oct 2014
Posts: 3
Location: Netherlands

PostPosted: Wed 22 Oct '14 11:21    Post subject: exclude from logs based on status code Reply with quote

(posted here because mod_setenvifplus might possibly offer the solution if only it would compile, but simple stuff first)

CentOS 6.5
Apache: 2.2.15

Hey Everyone!
I guess I'm a bit past the n00b stage, but way far from anything remotely termed guru. Maybe "hopeful journeyman" might be a bit more accurate. OK, here goes:

The objectives are:

a) get rid of 301's (& later on 304's) by not logging 'em at all

b) log 404's to their own log, let's say /var/log/httpd/404.log

I do a bunch of conditional logging, but all based on content (exclude jpg's from logs and so on) but until now, never status code. It should be simple, but in practice appears otherwise.

I tried this:

SetEnvIf Request_Status 301 rq=1
and then
SetEnvIf rq 1 do_not_log=1

Doubtless no one here will be surprised to learn that it's not working. (I was encouraged by apachectl configtest not compleining about syntax tho)

Guidance on this would be greatly appreciated.

Regards & TIA

-putter
Back to top
James Blond
Moderator


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

PostPosted: Mon 27 Oct '14 16:54    Post subject: Reply with quote

Did you add Cenv=!do_not_log to the end of the Custom log config?

Like

CustomLog /var/log/httpd/access.log vcommon env=!do_not_log
Back to top
putter1900



Joined: 22 Oct 2014
Posts: 3
Location: Netherlands

PostPosted: Tue 28 Oct '14 10:17    Post subject: Reply with quote

Indeed I did, but to no end. Thanks for jumping in!

A rather large chunk of RTFM seems to indicate SetEnvIf might not be the way to deal with this. SetEnvIfPlus just won't compile on CentOS 6.5, so sadly, I'm at a bit of a loss.

-Me
Back to top
James Blond
Moderator


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

PostPosted: Tue 28 Oct '14 17:22    Post subject: Reply with quote

What are you trying to do? Do you need all 404s or why the separate logs?
Back to top
putter1900



Joined: 22 Oct 2014
Posts: 3
Location: Netherlands

PostPosted: Wed 29 Oct '14 8:42    Post subject: Reply with quote

James Blond wrote:
What are you trying to do? Do you need all 404s or why the separate logs?


The goal is to severely clean up /var/log/access.log for ease of reading - AND - (as a secondary objective) put 404's in their own logfile for subsequent analysis...so to answer your question in a coherent manner; yes, 404's really are needed.

The reason 301's don't need to be logged is because (due to Wordpress mainly) the logs are saturated with 301's. I know 'em, and don't need to see 'em.

If we have a few vagrant/orphan status codes sitting around in there (403's [unlikely] 304's and the like, those can stay. They're likely to be few and far between anyway.

I trust this makes some limited sense. Thanks again for jumping in & getting involved. Hugely appreciated.

-me
Back to top
jraute



Joined: 13 Sep 2013
Posts: 188
Location: Rheinland, Germany

PostPosted: Wed 29 Oct '14 9:11    Post subject: Reply with quote

why not using awstats for logging and visualizing?
our experience with it has been very good.
the installation is easy and the statistics are well "itemised".

For all kinds of errors there is a section on the statistics site with a separate list for 404s.
Perfect for us.

Have a look at http://www.awstats.org/
Back to top
James Blond
Moderator


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

PostPosted: Wed 29 Oct '14 16:26    Post subject: Reply with quote

awstats are cool. Sometimes I needed something different and using grep and stuff wasn't an option. That is why I wrote my own tool https://github.com/JBlond/apache_log_parser which can be easily changed.
Back to top


Reply to topic   Topic: exclude from logs based on status code View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules