LogParser 2.2 – graph ping

ping -n 15 http://www.yahoo.com | logparser “SELECT TO_INT(REPLACE_STR(EXTRACT_VALUE(Text,’time’,’ ‘),’ms’,”)) AS Response INTO Ping.gif FROM stdin WHERE Text LIKE ‘%%Reply%%’ GROUP BY Response” -i textline -legend off -chartTitle “Ping Times” -view

via Ken Schaefer : LogParser 2.2 Titbit.

This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to LogParser 2.2 – graph ping

  1. Steve McAllister says:

    I have used LogParser over the years, mostly for IIS logs, including using the COM object to scan IIS logs in real-time. Since I had not used it in a while, I wanted to brush up on the command line and you generate an image and I have a need for that for another project.

    I could not get this example to work by just pasting it to a command prompt. I think it’s because there are left and right single and double quotes. I also use CygWin ping by default, so I modified your example so it would work for me. Let’s see if this works 🙂

    c:\windows\system32\ping.exe -n 15 http://www.yahoo.com | LogParser.exe “SELECT TO_INT(REPLACE_STR(EXTRACT_VALUE(Text,’time’,’ ‘), ‘ms’,”)) AS Response INTO Ping.gif FROM STDIN WHERE Text LIKE ‘%Reply%’ GROUP BY Response” -i textline -legend off -legend off -chartTitle “Ping Times” -view

    • Steve McAllister says:

      OK, let try HTML Encoded…
      c:\windows\system32\ping.exe -n 15 http://www.yahoo.com | LogParser.exe "SELECT TO_INT(REPLACE_STR(EXTRACT_VALUE(Text,'time',' '), 'ms','')) AS Response INTO Ping.gif FROM STDIN WHERE Text LIKE '%Reply%' GROUP BY Response" -i textline -legend off -legend off -chartTitle "Ping Times" -view

      • This worked. There are two other minor things to be aware of
        1. If you get it to run, the fact that ping runs 15 times causes a delay in the GIF being displayed.
        2) The command option -view causes your default GIF viewer to open when the query is done. The command window will not spit out the logparser query results until you close the GIF viewer. The query results looks like this
        Statistics:
        ———–
        Elements processed: 23
        Elements output: 10
        Execution time: 21.58 seconds

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s