Follow the Australian Telecommunications scene NEWSLETTER- FREE TRIAL
The Linux distillery
Bringing the world of Linux to you, David cuts through the tech and shows you how it works and how to use it, in terms that apply to any distro. RSS
Technology news and Jobs arrow The Linux distillery arrow Build better blogs with Linux
Build better blogs with Linux E-mail
The Linux distillery - The Linux user and switcher blog
by David M Williams   
Thursday, 02 October 2008
Your web server is storing a rich lode of data on who has visited you, from where, which pages they visited and so much more. You can find out what are the most popular pages on your site, the Google search terms being used to find you, and on and on.

One of the most well-known log file analysis tools is called analog which natively parses log files from the Apache web server, as well as a variety of other common log file formats.

Begin with an overview of your web site statistics with a command like this:
analog –A /etc/httpd/logs/access_log > /tmp/analog.html && firefox /tmp/analog.html

This causes analog to parse the Apache log at /etc/httpd/logs/access_log – which may be different on your system. It generates a HTML-based report and then displays this in the Firefox web browser.

The output will give you overview numbers, but they are very interesting. You will see how many successful requests your site has had as well as how many failed requests there were. You will see how many distinct hosts visited you and how much data you transferred along with other items.

Other reports analog can give you include search queries – namely terms entered into search engines which lead to you – as well as the Request Report which identifies the most popular files and pages on your site. There’s a lot of punch in analog; check out the online documentation for inspiration and guidance.

Actually, for some things you don’t need to use a package like analog if you’re just after real quick data. The regular assortment of Linux text tools like cut and sort and grep and uniq and sed and awk are all available for your pleasure.

You can lookup all the computers that have visited you with a simple command like this one:
cut –d “ “ –f1 /etc/httpd/logs/access_log

(provided you are using the default Apache log file format, which stamps the front of each line with an IP address. If you are using a customised log format you will need to modify the command appropriately.)

That command uses a basic Linux staple, cut, which essentially cuts fields out of text files. It doesn’t change the text file itself, it just displays the modified output. The parameters above say to retrieve the first field (-f1) and that the space character delimits fields (-d “ “.)

So there are some real simple – but remarkably powerful and effective – Linux tips which will give you greater web site performance as well as deliver enormous amounts of data on your visitors and popular pages.

What other sorts of things in Linux are of interest to you? What would you like to hear about?

Powered By Joomla Tags

Please enable JavaScript in your browser to post your comment!



 
< Next story in category   Previous story in the category >
iTWire user statistics Visitors last 30 days
694,279
Subscribers 15,210
#1 independent technology news advertise here
  •   *  
  • Search
  • AdvSeach
  • Login
  • Events
  • FreeStuff

- Advertisement -

Featured Whitepapers

Follow iTWire on Twitter

About iTWire

iTWire is all about technology news, information, jobs and community for the IT and telecommunications industry professional. Subscribe to our free ICT daily newsletter