« Previous Next »

Thread: Error: detected extra argument helpppppppp

Last post 11-01-2006 8:02 AM by LogParser User : Allan Pike. 16 replies.

Average Rating Rate It (5)

RSS

Page 1 of 2 (17 items) 1 2 Next >

Sort Posts:

  • 01-11-2006, 10:03 AM

    Error: detected extra argument helpppppppp

    Hi All.

    i have this working into a text file, however i now want to take yesterdays events into a html file using tpl template. I have an example template i have modified to contain my fields, 

    this is all taken from a script already present at this company to export the logs to txt file

    I do the following cmd were CSDC01 is a servername

    call C:\Daily-Checks\_chklogsnp1.bat CSDC01

    _chklogsnp1.bat contains

    "c:\program files\log parser 2.2\LogParser" -i:EVT -o:TPL –tpl:applog.txt "SELECT ComputerName, TimeGenerated, EventLog, EventID, EventTypeName, SourceName, Message  INTO %1-applog.htm FROM \\%1\Application WHERE TimeGenerated >= TO_LOCALTIME ( SUB(SYSTEM_TIMESTAMP(), TIMESTAMP('3', 'd') ) ) AND ((EventTypeName = 'Warning event') OR (EventTypeName = 'Error event'))"

    %1 is the server name pased in as a variable

    Error: detected extra argument "SELECT ComputerName, TimeGenerated, EventLog, Ev
    entID, EventTypeName, SourceName, Message  INTO CSDC01-applog.htm FROM \\CSDC0
    1\Application WHERE TimeGenerated >= TO_LOCALTIME ( SUB(SYSTEM_TIMESTAMP(), TIME
    STAMP('3', 'd') ) ) AND ((EventTypeName = 'Warning event') OR (EventTypeName = '
    Error event'))" after query

    if i modify it back to pump the output to a text file it works fine

    my template is this applog.txt shown below

    <LPHEADER>
    <HTML>
    <HEAD><TITLE> %FIELDNAME_1% application  Report</TITLE></HEAD>
    <BODY>
    <H1>%FIELDNAME_1% Application Log Report</H1>
    <TABLE BGCOLOR="#D0D0E0" BORDER="1" CELLPADDING="10">
    <TR>
        <TH>%FIELDNAME_1%</TH>
        <TH>%FIELDNAME_2%</TH>
        <TH>%FIELDNAME_3%</TH>
        <TH>%FIELDNAME_4%</TH>
        <TH>%FIELDNAME_5%</TH>
        <TH>%FIELDNAME_6%</TH>
        <TH>%FIELDNAME_7%</TH>
    </TR>
    </LPHEADER>

    <LPBODY>
    <TR>
         <TD><TT>%FIELD_1%</TT></TD>
         <TD><TT>%FIELD_2%</TT></TD>
         <TD><TT>%FIELD_3%</TT></TD>
         <TD><TT>%FIELD_4%</TT></TD>
         <TD><TT>%FIELD_5%</TT></TD>
         <TD><TT>%FIELD_6%</TT></TD>
         <TD><TT>%FIELD_7%</TT></TD>
    </TR>
    </LPBODY>

     

    This is doing me in so any help is greatly appreciated as this is my first attempt with ms log parser

     

     

  • 01-11-2006, 10:56 AM In reply to

    RE: Error: detected extra argument helpppppppp

    I copied all your examples and tried to run it on my machine and wasn't able to duplicate the error. :/

    I noticed one tiny thing that I doubt is an issue but might be worth mentioning. The hyphen used in your -tpl argument you posted here is not a normal ASCII hyphen, it is some unicode character. Is that just a copy and paste glitch or is that character maybe in your cmd file too?

    The only other thing I noticed probably wouldn't affect your problem but it does make the query a bit simpler.

    Instead of the parenthesized OR part at the end, you could just do:

    AND EventTypeName = ANY ('Warning event'; 'Error event')
  • 01-11-2006, 11:07 AM In reply to

    RE: Error: detected extra argument helpppppppp

    I have now made this work, seems strainge ms examples user .txt as the extension of the tpl template, i have change the template to be .tpl and it worked..

    However can i use a variable in the title and the body, doesn't seem to work?

     

    <HEAD><TITLE> %FIELD_1% application  Report</TITLE></HEAD>
    <BODY>
    <H1>%FIELD_1% Application Log Report</H1>

     

    Thanks in advance

  • 01-11-2006, 11:46 AM In reply to

    RE: Error: detected extra argument helpppppppp

    No, the FIELD_# variables can only be used in the body, they change from record to record whereas the LPHEADER section is only generated once per execution.

    What you could do though, is set the %1 argument of your cmd file as an environment variable then refer to that variable in your template.

    Check out the Log Parser | Reference | Output Formats | TPL | Template Files section of the help file for more information.
  • 01-11-2006, 5:18 PM In reply to

    RE: Error: detected extra argument helpppppppp

    Ok I will have a look tomorrow, many thanks for your help, i really appreciate it

     

  • 10-26-2006, 9:47 PM In reply to

    RE: Error: detected extra argument helpppppppp

    LogParser User : Allan Pike:
    Quote: No, the FIELD_# variables can only be used in the body, they change from record to record whereas the LPHEADER section is only generated once per execution. What you could do though, is set the %1 ar...

    Hello

    I have a similar query regarding system variables in a TPL file.  I want my HTML file to show when it was generated.  I have got that happening to a point, but I'm not getting local time, it's more like GMT.  Can I modify my TPL file below to achieve this ?

    <LPHEADER>                                                   
    <HTML>

    <HEAD>
    <TITLE>Error and Warning Events from System and Application Log</TITLE>
    <style type="text/css">
    <!--
    .style1 {font-size: 16pt}
    -->
    </style>
    </HEAD>

     

    <CENTER>
      <div style="font-family: Georgia; font-size: 28pt; color: #000000;">
        <p>Error &amp; Warning Events from System and Application Log</a></p>
        <p class="style1">Generated 0n %SYSTEM_TIMESTAMP%</p>
      </div>
    </CENTER>
    <BR>

     

  • 10-26-2006, 10:01 PM In reply to

    RE: Error: detected extra argument helpppppppp

     


     

     

  • 10-27-2006, 9:00 AM In reply to

    RE: Error: detected extra argument helpppppppp

    I'm not familiar with an environment variable named %SYSTEM_TIMESTAMP%. Is that something you are setting yourself?

    Why not just use the %DATE% and %TIME% variables? They are always formatted in localtime.
  • 10-29-2006, 4:39 PM In reply to

    RE: Error: detected extra argument helpppppppp

    LogParser User : Allan Pike:
    Quote: I'm not familiar with an environment variable named %SYSTEM_TIMESTAMP%. Is that something you are setting yourself? Why not just use the %DATE% and %TIME% variables? They are always formatted in loca...

    The variable %SYSTEM_TIMESTAMP% is a valid system generated variable within a TPL file (refer to the help file in Reference/Output Formats/TPL/Template Files).  As far as I can tell, %DATE% and %TIME% are not valid within a TPL file.  Any suggestions ?
  • 10-29-2006, 7:14 PM In reply to

    RE: Error: detected extra argument helpppppppp

    Oops. Been a while since someone told me to go read the help file. Yeah, I can see where SYSTEM_TIMESTAMP is in UTC format. So you tried DATE and TIME and they didn't work? They are built in environment variables which the TPL format should support..
  • 10-29-2006, 7:57 PM In reply to

    RE: Error: detected extra argument helpppppppp

    Thanks for that.  I have tried my own variables in the past but the output HTML page showed the variable name and not it's contents.  The %DATE% and %TIME% system variables did the same - the output is "Generated 0n %DATE% at %TIME%" which was generated from this part of my .TPL file

    <CENTER>
      <div style="font-family: Georgia; font-size: 28pt; color: #000000;">
        <p>Error &amp; Warning Events from System and Application Log</a></p>
        <p class="style1">Generated 0n %DATE% at %TIME%</p>
      </div>
    </CENTER>
    <BR><BR>

     

    Am I doing something wrong ?

     

  • 10-30-2006, 7:10 AM In reply to

    RE: Error: detected extra argument helpppppppp

    No, it probably just doesn't pick up those variables since they are special. Are you running LP from a batch file?
  • 10-30-2006, 2:02 PM In reply to

    RE: Error: detected extra argument helpppppppp

    Unfortunately, %DATE% and %TIME% aren't actually environment variables, so Logparser can't pick them up.  Also, it appears that Log Parser does use UTC time for the %SYSTEM_TIMESTAMP% and there doesn't seem to be a TO_LOCAL() call that would work in the LPHEADER field. 

    Best bet would be to make the batch file that says something like:

     

    set DateTime=%DATE% %TIME%

    logparser -o:tpl ....

     

    and have %DateTime% added.

     

  • 10-30-2006, 4:55 PM In reply to

    RE: Error: detected extra argument helpppppppp

    Yes, am running from a batch file - this is it:

    logparser.exe file:Tat.sql -o:TPL -tpl:EventMonitor.tpl -direction:BW

    sql file like this:

    Select ComputerName,
     EventLog,
     EventTypeName AS EventType,
     EventID,
     EventCategory AS Category, 
     Sourcename,
     Message,
     TimeGenerated
     
    INTO c:\web\*.html

    FROM \\server1\System, \\server1\application


    WHERE TimeGenerated >
     SUB( TO_lOCALTIME(SYSTEM_TIMESTAMP()),
     TIMESTAMP('0000-01-04 00:00:00', 'yyyy-MM-dd hh:mm:ss'))
    AND EventTypeName='Error event'

    OR TimeGenerated >
     SUB( TO_lOCALTIME(SYSTEM_TIMESTAMP()),
     TIMESTAMP('0000-01-04 00:00:00', 'yyyy-MM-dd hh:mm:ss'))
    AND EventTypeName='Warning event'

    ORDER BY TimeGenerated 
     

     

    Jeff - easy enough to do "set DateTime=%DATE% %TIME%" but how do I then add %DateTime% ?  All attempts to add user variables to my .TPL file ends up displaying the variable name instead of it's contents in my HMTL file.

     

  • 10-31-2006, 6:59 AM In reply to

    RE: Error: detected extra argument helpppppppp

    Using %DateTime% in your template should certainly work. Is there any chance you aren't using the latest version of Log Parser (2.2.10)?
Page 1 of 2 (17 items) 1 2 Next >
Microsoft Communities