IIS Server Security - IIS LogParser 2.1 COM Object - Syntax for "FROM" statement with long filenam

This is Interesting: Free IT Magazines  
Home > Archive > IIS Server Security > January 2004 > IIS LogParser 2.1 COM Object - Syntax for "FROM" statement with long filenam





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author IIS LogParser 2.1 COM Object - Syntax for "FROM" statement with long filenam
Alex K. Angelopoulos [MVP]

2004-01-24, 2:02 am

[cross-posted to scripting.wsh and likely most relevant IIS group,
inetserver.iis.security]

Can anyone shed light on a problem I'm having using the IIS LogParser COM
object to query CSV files?

I cannot successfully read files with long names; if I quote them the log
parser utility appears to append the entire long path name to the local
directory, and if I leave them bare they are parsed as mutliple tokens at
the spaces.

For now I'm simply converting the long filenames to short paths using FSO,
which makes my query statements work fine. This is an extremely crude way to
have to do it, though, and since I presumably am missing something about the
syntax for these calls I want to get the right way to do it.

Here's a crude example of how I'm doing this now; in this code snippet I
treat all script arguments as presumed CSV files and I am arbitrarily
echoing the initial column of the returned recordset just to verify that I
do indeed return records. Note that this currently uses the short filepath
conversion workaround.

Dim csv(): ReDim csv(uargs.Count - 1)
Dim i
For i = 0 to ubound(uargs)
csv(i) = fso.GetFile(uargs(i)).ShortPath
csv(i) = Chr(34) & uargs(i) & Chr(34)
next
dim fileset: fileset = Join(csv, ",")
Dim LogQuery : Set LogQuery = CreateObject("MSUtil.LogQuery")
Dim Input, Output
Set Input = CreateObject("MSUtil.LogQuery.CSVInputFormat")
Dim recordSet

Input.headerRow = True
Set recordSet = LogQuery.Execute("SELECT * FROM " & fileset & ", Input)
Do While Not recordset.atEnd
WScript.Echo(recordSet.getRecord().toNativeString(0))
recordset.MoveNext
Loop


Jeff White

2004-01-24, 4:34 am



"Alex K. Angelopoulos [MVP]"
quote:

> ' NOTE: I seem to have problems getting the log parser queries
> ' to recognize long path names.



strLogParserDir = "c:\documents\u0020and\u0020" _
& " settings\owner\my\u0020documents\my\u002
0" _
& "scripts\logparser"

strApacheDir = "C:\Program\u0020Files\" _
& "Apache\u0020Group\Apache2"

<quote>

How do I specify spaces in the <from_entity>
or <to_entity>?

Write spaces using the Unicode notation: \u0020.
If you are using a scripting language, make sure
that the Unicode notation is not parsed by the script
interpreter itself; for example, you might need to
specify the space as \u005cu0020

</quote>

LogParser.doc in LogParser 2.0

Jeff






Alex K. Angelopoulos [MVP]

2004-01-24, 9:34 am

Bingo. Much obliged, Jeff. I was going to gripe about this being missing
from Log Parser 2.1, but it turns out they did include an FAQ item on it in
the combined help file which I found when I went back to doublecheck.
Thanks!


Jeff White wrote:
quote:

> "Alex K. Angelopoulos [MVP]"
>
>
> strLogParserDir = "c:\documents\u0020and\u0020" _
> & " settings\owner\my\u0020documents\my\u002
0" _
> & "scripts\logparser"
>
> strApacheDir = "C:\Program\u0020Files\" _
> & "Apache\u0020Group\Apache2"
>
> <quote>
>
> How do I specify spaces in the <from_entity>
> or <to_entity>?
>
> Write spaces using the Unicode notation: \u0020.
> If you are using a scripting language, make sure
> that the Unicode notation is not parsed by the script
> interpreter itself; for example, you might need to
> specify the space as \u005cu0020
>
> </quote>
>
> LogParser.doc in LogParser 2.0
>
> Jeff




Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com