|
Answer» Hello together
I'm trying to write a batch script that helps me analyzing the IIS log file from yesterday with LogParser.
My first problem was to get the date of yesterday in format yymmdd, but I've wrote a simple C# program 'yesterday.exe' to get it.
My next problem is a bit more complicated for me and after checking websites for 2HOURS I try it here: I have a batch file for the LogParser that looks like this run.bat --8<----------------------------------------------------------------- echo off Logparser "SELECT date, TIME, c-ip, cs-username, cs-method, sc-status, cs-uri-query INTO extract_%1.txt FROM 'X:\SMTP Log\SMTPSVC1\ex%1.log' WHERE sc-status >= 400 AND cs-method = 'RCPT'" -i:IISW3C -RTP:-1 -->8-----------------------------------------------------------------
When I run it with 'run.bat 061003' it works fine. But I want to run it automaticly and I thought about using the following COMMAND to do that: 'yesterday.exe | run.bat'
This should paste the output of yesterday.exe ("061003") to run.bat from my understanding. But this is not working.
Does anyone has an idea why or another solution for my task?
Thanks and regards thalAlas no, you cannot pipe a value in as a parameter, use this
yesterday.exe | Set /P yday= run.bat %yday%
As a matter of interest, why didnt you use LogParser to create yesterday ?
GrahamThanks for your answer, but it's not working. When I echo that variable yday it's EMPTY. But yesterday.exe is ok.
D:\>yesterday.exe 061004
I did not thought about using LogParser for that. I will have a look at it today.
Thanks thalThank you very much. It took some time to find out how I can do that with LogParser, but now I have a batch file, creating another batch file with LogParser. That new batch file can then do the work.
Again, thank you.
|