JamesSkemp / logparserplus.com

Web site content for logparserplus.com
4 stars 0 forks source link

I have a question about logparser. #1

Open Shin-Dong-Ik opened 5 years ago

Shin-Dong-Ik commented 5 years ago

How are you. I'm currently using LogParser to analyze the DNS log, If the value of a particular field in the first line of the Log file is stored as a number, the string data in the field is not read. I wonder if there is a way to check whether the data in that field is a letter or a number.

JamesSkemp commented 5 years ago

Sorry for the delay.

I'd have to see your query to know more, but perhaps try TO_STRING in your SELECT or WHERE clause? https://logparserplus.com/functions/#function_TO_STRING

I'm not at a Windows machine at the moment, but you could also see what TO_INT gives you on a string and then in your WHERE clause include a check to exclude anything that isn't a string.

Shin-Dong-Ik commented 5 years ago

My query is simple:

LogParser -i: TSV -nskiplines: 30 -headerRow: off -iSeparator: spaces -nSep: 1 -e: 10 "SELECT to_string (field4) as ThreadID FROM "File" "

If you test with the above query, the first line's ThreadID value is numeric, and if the middle ThreadID value contains string data, an error of "Error while parsing field Field4: Value is not a relative integer" occurs. Conversely, if the first line's ThreadID value contains a string, and the number is in the middle, no error occurs.

If I understand it correctly, is it possible to put a condition in Where clause to exclude Int type data? If possible, please give me a sample.