LinuxQuestions.org
Review your favorite Linux distribution.
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 05-16-2007, 09:57 AM   #1
am0nrahx
LQ Newbie
 
Registered: May 2007
Distribution: Fedora Core 6
Posts: 8

Rep: Reputation: 0
Help writing a script for httpd


I am trying to write up a script that will display the total number of hits on my website each day listed in my httpd access logs (which includes the rotated ones), I want to be able to see for a specific date or for all dates.
 
Old 05-16-2007, 10:46 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

What have you created this far and which specific problem/problems are you running into?
 
Old 05-16-2007, 12:17 PM   #3
am0nrahx
LQ Newbie
 
Registered: May 2007
Distribution: Fedora Core 6
Posts: 8

Original Poster
Rep: Reputation: 0
I'm new to this whole scripting business. I have no idea how this information is stored within httpd, so any help right now would be appreciated.
 
Old 05-16-2007, 12:36 PM   #4
digitalnerds
Member
 
Registered: May 2007
Distribution: Debian
Posts: 103

Rep: Reputation: 15
Hi there

I suggest using a very good script out there named Awstats. You might have to change the format used by apache to save the logs (can be either common or combined) since the awstats uses combined mode. As about parsing all logs (archived/rotated ones too) you would need to make some changes so awstats can read them all. For this you would need to modifiy the logrotate config file (usually located in /etc/logrotate.d) and make it look something like:

Code:
/usr/local/apache/logs/*log
{
notifempty
daily
rotate 7
compress
sharedscripts
prerotate
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=mydomainconfig
endscript
postrotate
/usr/bin/killall -HUP httpd
endscript
}
so basically include the awstats update process into the logrotate preprocessor command. (bolded lines above are the preprocess of logrotate. Of course you would need to modify the PATH to the logs in the above example to match your server setup. I hope it helps

Regards
Andy

Last edited by digitalnerds; 05-16-2007 at 01:03 PM.
 
Old 05-16-2007, 12:43 PM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Take a look at webalizer as well.
Hope this helps.
 
  


Reply



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
Need help writing script Rustylinux SUSE / openSUSE 1 12-05-2006 10:05 AM
Need help for writing Script vikrambhimbar Linux - Software 2 03-05-2006 04:28 AM
Help writing with SH script? SirJinX Programming 1 01-24-2006 05:57 AM
Need help writing a script wswartz Linux - Software 3 04-28-2004 03:35 PM
writing a Script spanky5125 Linux - Security 5 01-08-2002 09:22 AM

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

All times are GMT -5. The time now is 05:42 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