Join Query Using LogParser

3.8k views Asked by At

In Log Parser Can we write a join query on two files ? Because i want to display an output from two files based on one common relation between them, Is this possible to do with Log Parser? if so please suggest an example, Thanks in Advance

2

There are 2 answers

0
CWoods On BEST ANSWER

Apparently LogParser v2.2 (latest version unfortunately) doesn't support JOIN operations.

I've seen a few samples on the internet that suggest ways to try and simulate a JOIN. One used a IN operation with a sub-query in the WHERE clause:

SELECT * FROM Log1 WHERE FieldA IN (SELECT FieldA FROM Log2)

That may be sufficient for what some people need JOINs for - filtering. But if you want to see data from two different sources on the same line - that's not going to accomplish it.

2
mcook On

If the files are in the same format, you can reference both in your FROM statement, for example:

SELECT * 
FROM c:\*.log
WHERE cs-username = 'joe'

This example would include any files that end with .log in the root of c:\