Archive for the tag 'stats'

Rotating Apache log files using Cronolog

I must confess that I am a stats freak. If you are a long time reader of my blog, then you would have known that by now yourself. ;-) This explains the reason why I want to preserve my Apache log files in spite of using a variety of stat services like Google Analytics, WordPress stats, statscounter, performancing metrics (before it was closed).

The default Apache configuration preserves the log files only for the last 10 days, but I wanted to permanently archive this files. After some searches in Google I came across an excellent program called Cronolog. Cronolog is a simple filter program which writes each log entry to a separate log file named after the filename format specified. You can use a variety of parameters like current date, time etc to define the filename template.

First we have to install cronolog, either by using aptitude or by downloading it from its download page. Then you have to change the log file name path in the virtual host file. (In Ubuntu Gusty, the virtual host files are situated in the path /etc/apache2/sites-enabled). I am using the following file format for this blog
# Custom log file locations
LogLevel warn
ErrorLog "|/usr/sbin/cronolog /path/to/logs/%Y/%m/%Y-%m-%d-sudarmuthu.com-error.log"
CustomLog "|/usr/sbin/cronolog /path/to/logs/%Y/%m/%Y-%m-%d-sudarmuthu.com-access.log" combined

which will store my log files in separate folders for each year and for each month, like the below hierarchy
/2007/12/2007-11-01-sudarmuthu.com-access.log
/2007/12/2007-11-02-sudarmuthu.com-access.log
......
/2008/01/2008-01-01-sudarmuthu.com-access.log
/2008/01/2008-01-02-sudarmuthu.com-access.log
......

You can use a variety of modifiers for the filename and I have documented some of them in the below table. You can get more information from its documentation.

Specifier Description
Time fields
%H hour (00..23)
%I hour (01..12)
%p the locale’s AM or PM indicator
%M minute (00..59)
%S second (00..61, which allows for leap seconds)
%X the locale’s time representation (e.g.: “15:12:47″)
%Z time zone (e.g. GMT), or nothing if the time zone cannot be determined
Date fields
%a the locale’s abbreviated weekday name (e.g.: Sun..Sat)
%A the locale’s full weekday name (e.g.: Sunday .. Saturday)
%b the locale’s abbreviated month name (e.g.: Jan .. Dec)
%B the locale’s full month name, (e.g.: January .. December)
%c the locale’s date and time (e.g.: “Sun Dec 15 14:12:47 GMT 1996″)
%d day of month (01 .. 31)
%j day of year (001 .. 366)
%m month (01 .. 12)
%U week of the year with Sunday as first day of week (00..53, where week 1 is the week containing the first Sunday of the year)
%W week of the year with Monday as first day of week (00..53, where week 1 is the week containing the first Monday of the year)
%w day of week (0 .. 6, where 0 corresponds to Sunday)
%x locale’s date representation (e.g. today in Britain: “15/12/96″)
%y year without the century (00 .. 99)
%Y year with the century (1970 .. 2038)

Google Gadget to keep track of your FeedBurner stats

FeedBurner Stats Google GadgetI had some free time this weekend and I used it to create my second Google Gadget called called FeedBurner stats. (By the way my first gadget was Bloglines Notifier, which notifies the count of unread items in your Bloglines account). It uses FeedBurner Awareness API to fetch the subscriber count of your FeedBurner feed and displays it using Google Charts API.

The full source code of this gadget is available here and if you are interested you can add it to your Google personalised page by clicking this button. Add to Google

After you add the gadget, you just need to enter your FeedBurner feed URL. The gadget will fetch the subscriber count for the past one week and will display it in a nice bar graph using Google Charts API.

API’s used

The following are the API’s used for creating this gadget

Year End Stats for 2007 (Graphs)

When I published my year end stats, little did I know that numbers alone doesn’t matter much, unless they are presented in an easily-to understand manner.

So here I am representing the same numbers but in a much more understandable manner, with some support from the excellent Google Chart API, which I learned during pipesCamp.

Number of posts

You could see that the number of posts has almost dropped by 40% in 2007. There were 64 posts in 2006 where as only 38 in 2007. One reason for this is that lot of unexpected things happened in my personal life which took me away from the computer and the other reason is that I got busy and free time became a rare commodity for me. So this is an area where I should improve.

Number of comments

Again, as with the number of posts, the number of comments was also less by around 40%. There were 394 comments in 2006 but only 220 in 2007. This also includes my own comments; maybe I should represent my comments separately.

Average number of characters in posts

This graph clearly shows that average number of characters in my posts. Even though I have written fewer posts in 2007, the average number of characters has increased, which is good (which also means that I have become very talkative ;) ). This is very good and is also motivating. In 2008 I should keep up the length of the posts and at the same time should also try to increase their number.

Total number of characters in posts

This graph clearly shows that even though I have written fewer posts, I have almost written the same amount of characters in 2007 when compared with 2006, which is again motivating.

I have really become addicted to stats now and will try to dig more deep into my blog to unearth other valuable information when I get some time. This explains why everybody was soo fascinated by Yuvi’s cool graphs.

Meanwhile you can also publish your yearend stats by using my Year End Stats WordPress Plugin. So what does your yearend stats speak about your blogging habit? Please leave a link to your yearend stats in the comments so that I can have a look at it.

PS: I would really love to see how Yuvi has scaled up this year. May be Yuvi, do it when you find time in between your exams.

Year End Stats for 2007

Publishing year end stats seems to be the new fashion and so here are the year end stats for my blog.

  • Total number of posts in 2007: 38 Posts
  • Total number of comments in 2007: 220 comments
  • Average length of posts in 2007: 3048.03 Letters
  • Total length of all posts in 2007: 115825 Letters

By the way this is very low when compared to my previous year (2006) stats

  • Total number of posts in 2006: 64 Posts
  • Total number of comments in 2006: 394 Comments
  • Average length of posts in 2006: 1813.16 Letters
  • Total length of all posts in 2006: 116042 Letters

I guess it is right time that I start writing more on my blog. So here goes my first resolution for the year 2008, write more in my blog. :)

I have also created a WordPress Plugin called WP Year End stats which you can use to get stats for your blog.

Wish you all a happy new year :)

How safe is your data?

One of the things which shocked me when I came out of my hiding period is the sudden disappearance of Performancing Metrics. As you have guessed by now, I was using it here to have an understanding of how my users use my site.

Performancing was recently acquired by PayPerPost and they couldn’t get the deal right with Metrics. This has made them to stop the hosting of Metrics service and have decided to release the code as open source, which may take some time. So the net result is that now I am left without a Stats package ;-)

Don’t get me wrong here. I am not here to criticize or accuse Performancing or PayPerPost. Metrics was a great product and I was one among the thousands of happy customers they had. It was totally free and was completely invisible on the page, since you don’t need to display a graphics or a back link on your site. They were not deleting the old data (as most stats services do) and the stats were also private. But what concerns me is that I have lost all the valuable stats data which was recorded till now by the service. Worst still, according to the comment by Nick, there is no way for me to export the stats data out of the system. :(

Now the question which has popped up in my mind is “How safe is my data?” with the other (web 2.0) websites. So just for a wild imagination, what happens if Google gets dissolved or bought up like Performancing or goes bankrupt (Just imagine). My (digital) life may come to a standstill without access to my email (gmail) and schedules (Calendar). And what if the same fate happens to Yahoo, I will loose all my bookmarks (del.icio.us), my old emails (Yahoo Mail), my photos (flickr and Yahoo photos) etc. Well, it gets too shocking. Isn’t it? :( Worst still what happens if they say, pay $XXX to get access to your data?

This leaves me with lot of questions and also with some shock. But back to the original problem, now I have to look out for a new Metrics/Stats package. I am not able to decide whether I have to go for a 3rd party package (like Feedburner, Google Analytics etc) or install my own copy in my server (like Mint, Analog, Awstats etc). Guys do you have any recommendations?