Grups de Google ja no admet publicacions ni subscripcions noves de Usenet. El contingut antic es pot continuar consultant.

date logic in logparser

400 visualitzacions
Ves al primer missatge no llegit

Gary Chan

no llegida,
4 d’abr. 2003, 2:57:074/4/03
a
is there some sort of date logic variables such as now()
or to datediff() in logparser? I am trying to only grab
the last 24 hour records from IIS log.

Ritchie

no llegida,
4 d’abr. 2003, 8:01:414/4/03
a
"Gary Chan" <gary...@yahoo.com> wrote in message news:007d01c2fa7f$ca1416e0$3001...@phx.gbl...

> is there some sort of date logic variables such as now()
> or to datediff() in logparser? I am trying to only grab
> the last 24 hour records from IIS log.

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


Gary Chan

no llegida,
4 d’abr. 2003, 15:00:574/4/03
a
JT.exe? is this a free tool too? How can I find more
info about this?

>.
>

Ritchie

no llegida,
4 d’abr. 2003, 15:23:224/4/03
a
"Gary Chan" <gary...@yahoo.com> wrote in message news:049d01c2fae4$e82aed10$3301...@phx.gbl...

> JT.exe? is this a free tool too? How can I find more
> info about this?

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


Curtis Anderson

no llegida,
6 d’abr. 2003, 20:07:206/4/03
a
Ritchie wrote:
> Ah LogParser... the utility from Hell. Makes JT.EXE seem like a
> walk in the park :)

LOL! If that doesn't descibe LogParser to a T then I don't know what does!


0 missatges nous