« Previous Next »

Thread: When reading from CSV, chart is actually charting data instead of placing on x or y axis.

Last post 04-19-2007 6:16 PM by LogParser User : nigeldude. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 04-18-2007, 4:47 PM

    When reading from CSV, chart is actually charting data instead of placing on x or y axis.

    Problem:

    When selecting via the input format CSV, it charts differently than reading from the

    IISW3C.  The subsequent graphs do not come out as expected.

    1) This works fine and creates a wonderful graph:

    query 1:
    logparser "SELECT TO_STRING (TO_localtime( to_timestamp ( date, time) ), 'HH' ) AS Hour,

    COUNT(*) AS Hits INTO %filename%HITS_PER_HOUR_03_Working.gif FROM %_inputfile% where cs-

    uri-stem like '%webpage%'GROUP BY Hour ORDER BY Hour ASC" -i:IISW3C -o:CHART -values:off

    -chartType:%1 -chartTitle:"Hits Per Hour Working" -groupSize:620x460

    In above case the input file is the IISLOG.  It ends up creating a superb graph utilizing

    either line or bar3d as the chartType, and places the hour either along the X or Y Axis,

    (depending on graph type) which is great.


    2)
    Unfortunately, I want to capture the distinct c-ips per our, so I run this, and throw it

    into a file for later reading, since we cannot utilize distinct with group by.

    rem grab distinct IP's per hour
    logparser "Select TO_STRING (TO_localtime( to_timestamp ( date, time) ), 'HH' ) AS Hour,

    c-ip into nigel.log from %_inputfile% group by Hour, c-ip " -q -o:csv -i:IISW3C

    And then to create the graph:

    rem create chart
    logparser "Select Hour, count(*) as distinctuser INTO %filename%

    Unique_HITS_PER_HOUR_03.gif from nigel.log group by Hour order by Hour asc " -q -i:csv -

    o:CHART -values:off -chartType:%1 -chartTitle:"%1 Unqiue Hits By Hour" -groupSize:300x200

    The graph does not come out at all as expected it graphs the hour as values instead of

    placing on the x or y axis.

    3)

    So I attempted a little test, and this should work, I place the data from query 1 above

    and then create the graph from that data, unfortunately this messes up the x and y axis

    as well and plots the hours instead of running them along the x or y.

    Place data from query 1 above into file hitstomainpage.txt

    logparser "SELECT TO_STRING (TO_localtime( to_timestamp ( date, time) ), 'HH' ) AS Hour,

    COUNT(*) AS Hits into Hitstomainpage.TXT FROM %_inputfile% where cs-uri-stem like '%

    webpage%'GROUP BY Hour ORDER BY Hour ASC" -i:IISW3C -q -o:csv

    This gives us simple data:
    Hour,Hits
    00,22
    01,19
    02,1
    03,4
    04,33
    05,31
    06,110
    07,135
    08,288
    09,365
    10,466
    11,346
    12,394
    13,382
    14,321

    And now all I would like to do is create a simple graph with the hour along the x or y

    axis, and the HITS graphed. So this query should work well for that:

    logparser "Select  Hour, Hits INTO %filename%TOTAL_HITS_PER_HOUR_03_TEST.gif from

    Hitstomainpage.TXT order by Hour asc " -q -i:csv -o:CHART -values:off -chartType:%1 -

    chartTitle:" hits to main page not working" -groupSize:640x480

    Unfortunately the above creates a line or bar3d graph, graphing the hour as well as the

    hits number, instead of the desired results.

    I believe it may be the way logparser is reading the data type, or for some reason chart

    is acting differently with input as a CSV as opposed to the actual raw iisw3c format.


    Thanks for any help,
    Nigel

     


     

  • 04-18-2007, 4:49 PM In reply to

    RE: When reading from CSV, chart is actually charting data instead of placing on x or y axis.

    Sample graphs included.

    -Nigel

     

  • 04-19-2007, 12:04 PM In reply to

    RE: When reading from CSV, chart is actually charting data instead of placing on x or y axis.

    I think to_string() is what you need to do.  Logparser likes to graph numbers so forcing it to not be a number should fix your problems (assuming I read it all correctly).

     

  • 04-19-2007, 6:16 PM In reply to

    RE: When reading from CSV, chart is actually charting data instead of placing on x or y axis.

    Jeff,

    Thank you very much for the assistance. You are correct.

    Here is the final Resolution:

    logparser "Select TO_STRING(Hour) AS theHour, count(*) as distinctuser INTO Unique_HITS_PER_HOUR_03_TESTING.gif from nigel.log group by theHour" -q -i:csv -o:CHART -values:off -chartType:BAR3d -chartTitle:"TESTING Unqiue Hits By Hour" -groupSize:600x480 -view

    This ends up making the desired graph!

    The help is much appreciated.

    -Nigel

     

     

Page 1 of 1 (4 items)
Microsoft Communities