Re: [CentOS] parsing out adjacent text

2014-06-05 Thread lee
Tim Dunphy writes: > I'm very grateful. Ok so here is what I have so far of my script to get the > number of apache requests to a given host: > [...] > So now my question is, is there any way to limit the size of the output log > from within the script without having to use logrotate? You could

Re: [CentOS] parsing out adjacent text

2014-06-03 Thread Bowie Bailey
On 6/3/2014 11:55 AM, Tim Dunphy wrote: > Ok this is what I came up with: > > #!/bin/bash > # this script parses mod_status to see which hosts are getting the most > requests > > while true > do > echo "Time and date: $(/bin/date +"%D %H:%M:%S")" >> > /tmp/apache_request_log >> /tmp/apache_request_

Re: [CentOS] parsing out adjacent text

2014-06-03 Thread Stephen Harris
On Tue, Jun 03, 2014 at 11:55:55AM -0400, Tim Dunphy wrote: > while true > do > echo "Time and date: $(/bin/date +"%D %H:%M:%S")" >> > /tmp/apache_request_log >> /tmp/apache_request_log > echo ???hostname: $(/bin/hostname -f)\n??? >> /tmp/apache_request_log > echo ???host ip: $(/bin/hostname -i)?

Re: [CentOS] parsing out adjacent text

2014-06-03 Thread Tim Dunphy
Ok this is what I came up with: #!/bin/bash # this script parses mod_status to see which hosts are getting the most requests while true do echo "Time and date: $(/bin/date +"%D %H:%M:%S")" >> /tmp/apache_request_log >> /tmp/apache_request_log echo “hostname: $(/bin/hostname -f)\n” >> /tmp/apach

Re: [CentOS] parsing out adjacent text

2014-06-03 Thread Patrick Bervoets
op 03-06-14 16:32, schreef Tim Dunphy: What I need to figure out at this point is how to get the time and date info on the same line as it's category. ie get Time and date: 06/03/14 10:24:09 instead of Time and date: 06/03/14 10:24:09 printf "Time and date: $(/bin/date +"%D %H:%M:%S")\n" sol

Re: [CentOS] parsing out adjacent text

2014-06-03 Thread Keith Keller
On 2014-06-03, Tim Dunphy wrote: > Ok! So this is where my script is at this point: I strongly suggest that if you are writing a program to use a better language. bash is really painful for this sort of task. Here's a Perl script that queries /server-status: http://www.perlmonks.org/?node_id=4

Re: [CentOS] parsing out adjacent text

2014-06-03 Thread Tim Dunphy
Ok! So this is where my script is at this point: #!/bin/bash # this script parses mod_status to see which hosts are getting the most requests while true do echo "Time and date:" >> /tmp/apache_request_log /bin/date +"%D %H:%M:%S" >> /tmp/apache_request_log echo -e "\n" echo “hostname:” >> /tmp/

Re: [CentOS] parsing out adjacent text

2014-06-03 Thread Tim Dunphy
> > Try accessing the stats with the additional "?auto" suffix, it is meant to > be machine-readable, and is much shorter, e.g: > > http://$(hostname -i)/server-status/?auto Awesome tip! This is some of the output I get when I run this command: [root@uszmpwslp014lc script]# GET $(hostname -f)/s

Re: [CentOS] parsing out adjacent text

2014-06-03 Thread Marios Zindilis
On Tue, Jun 3, 2014 at 4:56 PM, Tim Dunphy wrote: > Guys, > > Thank you all for your input. I can't believe how helpful this list is and > I'm very grateful. Ok so here is what I have so far of my script to get the > number of apache requests to a given host: > > #!/bin/bash > > # this script pa

Re: [CentOS] parsing out adjacent text

2014-06-03 Thread Tim Dunphy
Guys, Thank you all for your input. I can't believe how helpful this list is and I'm very grateful. Ok so here is what I have so far of my script to get the number of apache requests to a given host: #!/bin/bash # this script parses mod_status to see which hosts are getting the most requests

Re: [CentOS] parsing out adjacent text

2014-06-03 Thread Patrick Bervoets
op 03-06-14 15:18, schreef Tim Dunphy: [root@uszmpwslp014lc ~]# GET http://$(hostname -i)/server-status | grep -i requests/sec 4.08 requests/sec - 80.9 kB/second - 19.8 kB/request That works ok. And next I'm grepping it back down and awking it to just the part I'm interested in: [root@usz

[CentOS] parsing out adjacent text

2014-06-03 Thread Tim Dunphy
hey all, I'm trying to figure out how to use apache's mod_status module to figure out which of the web servers in a farm of six are processing more requests than others. I'm writing a script to grep out requests per second from the status module like this: [root@uszmpwslp014lc ~]# GET http://