Ah LogParser... the utility from Hell. Makes JT.EXE seem like a
walk in the park :)
LogParser doesn't have built-in dateadd/datediff functions. However it
does have a SUB() function. Trouble is, it doesn't behave as expected
where dates/times are concerned. For instance SUB(now, now) equals 11-30
and not zero!
And because of this offset, SUB(today - yesterday) equals 12-01. Soooo,
to retrieve yesterdys logs, make your SQL statement something like: -
SELECT *
FROM *.log
WHERE TO_STRING(SUB(TO_LOCALTIME(SYSTEM_TIMESTAMP()),
date), 'yyyy-MM-dd') = '12-01'
Alternatively create the SQL statement on the fly, something like:-
@echo off&setlocal
set sql=yesterday.sql
type nul %sql%
>>%sql% echo/SELECT *
>>%sql% echo/FROM *.log
>>%sql% echo/WHERE date = '%yy%-%mm%-%dd%'
Where variables %yy%, %mm% and %dd% contain yesterdays date, search this
group or see http://www.commandline.co.uk/cmdfuncs/dandt/ to find out how.
--
Ritchie
>.
>
It's nothing to do with log parsing, I only mentioned it as it has
a steep learning curve, but not when compared with LogParser
date arithmetic.
JT is part of the resource kit and a free download from MS. Its a
commandline interface for the "Task Scheduler" service. You could
always search this group for more info (hint hint): -
http://groups.google.com/groups?q=cmdprompt.admin+jt
--
Ritchie
LOL! If that doesn't descibe LogParser to a T then I don't know what does!