« Previous Next »

Thread: Trying to get the last 15 min from a hourly IIS log

Last post 06-17-2009 5:59 PM by maximusdm. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 06-09-2009, 3:24 PM

    Trying to get the last 15 min from a hourly IIS log

     Hello all,

    The query below always returns "zero" elements. What am I doing wrong?
    The records on the file below range from 2009-05-30 14:59:59 --> 2009-05-30 15:59:59

    logparser "SELECT time, cs-uri-stem INTO C:\Temp\15min.csv FROM C:\Temp\ex09053010.log" -minDateMod:"2009-05-30 15:45:00" -o:csv

    Thank you

    MDM
  • 06-17-2009, 3:17 AM In reply to

    • ksingla
    • Top 10 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: Trying to get the last 15 min from a hourly IIS log

    minDateMod option picks files which are modified after the specified date from the list of files to parse. It doesn't filter the records read from a file. For specifying date range for records, you can use to_int to convert the timestamp to int and then specify the timestamp range as integers.

    Thanks,
    Kanwal

    Follow me on twitter at http://twitter.com/kjsingla
  • 06-17-2009, 11:35 AM In reply to

    • swobi
    • Not Ranked
    • Joined on 04-06-2007, 8:03 PM
    • Posts 11

    Re: Trying to get the last 15 min from a hourly IIS log

    Hi!

    I found an example in the excellent Logparser Helpfile (topic: Frequently Asked Questions) and modified it to your needs:

    SELECT *
    FROM <logfile>
    WHERE TO_TIMESTAMP (date, time) >= SUB( TO_TIMESTAMP ('
    <your_time>','hh:mm:ss'), TIMESTAMP( '15', 'mm' ) )

     If you want the last 15 minutes from the current moment you could use

    SELECT * 
    FROM 
    <logfile> 
    WHERE TO_TIMESTAMP (date, time) >= SUB( SYSTEM_TIMESTAMP(), TIMESTAMP( '15', 'mm' ) )

    cheers
      swobi


     

  • 06-17-2009, 5:59 PM In reply to

    Re: Trying to get the last 15 min from a hourly IIS log

    I will test your suggestion for sure but in the meantime I am building the query like this:

    "SELECT time, cs-uri-stem INTO C:\1.csv FROM C:\ex09053010.log WHERE time > '15:45:00'"

     It seems to work great :)

     Thank you!

     

    MDM
Page 1 of 1 (4 items)
Microsoft Communities