Coloring LogParser Pie Charts

by fwhagen Thu, 19 February 2009

Charting from LogParser is a very useful and powerful feature.  I enjoy collating our data into charts on hourly and daily summaries.  One of the charts I produce for my own use for the websites at work is Browser shares, like this one:

I especially like how all of the IE points are shades of blue.  Of course, you don't get that behavior out of the box.  But you can "style" the chart using a JScript config file.  The one I use is below:

// Title info
chart.Title.Font.Name = "Verdana";
chart.Title.Font.Size = 11;
chart.Title.Font.Bold = "True";

chart.SeriesCollection(0).DataLabelsCollection(0).Font.Size = 9;

for(nI=0; nI < chart.SeriesCollection(0).Points.Count; nI++)
{
    if (chart.SeriesCollection(0).Points(nI).GetValue(1) == "IE8")
        chart.SeriesCollection(0).Points(nI).Interior.Color = "#0099FF";
    if (chart.SeriesCollection(0).Points(nI).GetValue(1) == "IE7")
        chart.SeriesCollection(0).Points(nI).Interior.Color = "#008FE1";
    if (chart.SeriesCollection(0).Points(nI).GetValue(1) == "IE6")
        chart.SeriesCollection(0).Points(nI).Interior.Color = "#3876B7";
    if (chart.SeriesCollection(0).Points(nI).GetValue(1) == "Firefox")
        chart.SeriesCollection(0).Points(nI).Interior.Color = "#D87023";
    if (chart.SeriesCollection(0).Points(nI).GetValue(1) == "Safari")
        chart.SeriesCollection(0).Points(nI).Interior.Color = "#CFCCCC";
    if (chart.SeriesCollection(0).Points(nI).GetValue(1) == "Chrome")
        chart.SeriesCollection(0).Points(nI).Interior.Color = "#2DB632";
    if (chart.SeriesCollection(0).Points(nI).GetValue(1) == "Opera")
        chart.SeriesCollection(0).Points(nI).Interior.Color = "#BC1B12";
    if (chart.SeriesCollection(0).Points(nI).GetValue(1).substring(0,8) == "Netscape")
        chart.SeriesCollection(0).Points(nI).Interior.Color = "#246C6D";
}

Keywords:

Filed Under: LogParser

DateTime in IIS Logs Using LogParser

by fwhagen Fri, 23 January 2009

Everytime I need to render date and time to a DateTime field, I have to scour the Internet to figure out how.  Well, here is how:

If you need to get hourly statistics on your website, select and group by the following metric:

TO_LOCALTIME(QUANTIZE(TO_TIMESTAMP(date, time),3600)) AS Hour

This will properly combine date and time and offset by the correct timezone to a single datetime field recognized by most data parsers.  And it will look like this:

2009-01-21 12:00:00

It shouldn't be too difficult to change that to minutes, seconds, periods, whatever you need.

Keywords:

Filed Under: LogParser

TextBox

RecentPosts