Monday, January 31, 2011

Apache: Track how much time a request took

To track the time taken to server a request by apache is just a matter of adding one extra parameter in your config file and this is how you do that -

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T/%D" combined

So if you see we have added only two additional parameters -

%T =
The time taken to serve the request, in seconds.
%D = The time taken to serve the request, in microseconds.

Once you make the config changes live by restarting your apache server, tail the access logs and you will now see the the time spent to serve the request at the end of the line, along with other access logs parameters.


172.28.90.21 - - [31/Jan/2011:21:29:15 -0800] "GET /repos/ HTTP/1.1" 401 401 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13" 0/446

Hope it helps someone. Thanks/-

-Debu

Wednesday, January 26, 2011

Linux way of selctive backups

Sometimes we have a choice of only backing up some of the selected files from an
application or some other very crucial files. Below is how I do it in a real quick way:

cat >> /etc/bkup.conf
/usr/local/apache/conf/httpd.conf
/usr/local/apache/conf/httpd.global.conf
/usr/local/apache/conf/httpd.mod_jk.conf
/usr/local/apache/conf/vhosts/*
/usr/local/apache/conf/httpd.vhosts.include.conf
/usr/local/apache/conf/httpd.ssl.conf
EOF

Then I run tar command with -T flag pointing to the file which contains
the list. In my case it is /etc/bkup.conf

tar -cjf bkup-WebConfig-`date +%Y-%m-%d`.tar.bz2 -T /etc/bkup.conf

And you have your selective backup ready!

Thanks/-
DEBAJIT

RCA - Root Cause Analysis

An important step in finding the root causes of issues or occurrences that happen within a system or organization is root cause analysis (RC...