LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-06-2014, 11:11 PM   #1
jagafirst
LQ Newbie
 
Registered: May 2011
Posts: 3

Rep: Reputation: 0
Hoe to apache log managing in Bash script.


I have configured multiple virtual host in my server. I want to monitor the apache hits in daily basis from each virtual-host.I have written a script for single host log file.But no idea about multiple log files simultaneously.
#!/bin/bash
accesslog=$logrot/access.log-$fileDT
cat $accesslog | grep ^[0-9] | awk '{ print $1 }' | wc -l

Thanks.
 
Old 11-07-2014, 02:47 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Code:
for accesslog in  LIST OF NAMES HERE
do
    grep -c ^[0-9]   $accesslog  /dev/null
done
or

Code:
for accesslog in   $logrot/access.log*
do
    grep -c ^[0-9]   $accesslog  /dev/null
done

Last edited by linosaurusroot; 11-07-2014 at 02:49 AM.
 
  


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
BASH - parse apache log for requests per CIDR /24 Scruff Programming 3 02-06-2011 01:38 PM
(Bash) Redirect all output from script to all.log and copy of errors to err.log hmsdefender Programming 5 03-05-2010 01:52 PM
Bash script to log into website paul_l Programming 3 09-03-2009 05:56 AM
how to log everything from a bash script to a file prodsac Linux - Server 2 04-15-2008 04:56 PM
Bash script for server log (namely var/log/messages) tenaciousbob Programming 17 05-24-2007 10:43 AM

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

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