Totals row at the end - Logparser

Posted by Techie Cocktail | 6:33 PM | , | 0 comments »

I wanted to display a totals row at the end in a Logparser query. Thought of sharing the magic.

'WITH ROLLUP' keyword does the magic.

Things to note:
'WITH ROLLUP' should be used immediately after GROUP BY clause (not after ORDER BY)

If you try to use 'ORDER BY' clause after 'WITH ROLLUP', the totals column will come in the first line but it depends on what you are sorting.

Also, if you are using Visual Logparser tool to run the query having 'WITH ROLLUP', it doesn't work and gives an error: 'Input string was not in a correct format'
But it works completely fine when run from the command line which is strange.

Example Query:
logparser "select Top 5 Date, grouping(date) as
Gdate, c-ip as IPAddress, SUM(10), count(*) as [Count] from where c-ip like 'xx.xx%' group by Date, ipaddress with rollup" -stats:off

check out the magic.

0 comments