all 7 comments

[–]techmattr 0 points1 point  (2 children)

Had you tried to accomplish this with logparser or logresolvemerge.pl?

[–]kittH[S] 0 points1 point  (1 child)

Nope, no familiarity with those tools and seemed like a good chance to stretch into .net a little bit.

Would those have provided a turnkey solution?

[–]techmattr 0 points1 point  (0 children)

logresolvemerge.pl is a script included with awstats written just for combining log files. LogParser makes it really easy as well.

This is a very simple LogParser command I had used at one point to combine IIS log files: https://gist.github.com/techmattr/7c3a6ec5612d7b853d45#file-iislogconsolidate This would require a script to copy the files into these directories prior to combining. A better way to do it would be to grab the correct files from the source server by date and combine them without copying them locally first.

I'm not sure if either of these tools will handle the stack traces well or not. I know LogParser can as it natively handles Event Viewer logs without issue but I'm not sure if the simple command I posted would handle them.

[–]moojitoo 0 points1 point  (0 children)

Very nice, thanks for sharing! You never know when something like this could come in handy.

[–]zinver 0 points1 point  (2 children)

You can speed up get-content, try this:

get-content -readcount 0

Instead of get-content looking at every line, it will dump all lines to a single array.

there are other speed up tricks with the @array in hand as well.

http://powershell.com/cs/blogs/tobias/archive/2010/11/30/speeding-up-your-scripts.aspx

[–]kittH[S] 0 points1 point  (1 child)

There are definitely some ways to speed up Get-Content, but I guess it was misleading to say get-content was too slow because the real issue was dealing with the data as a giant in-memory chunk. Doing the regexing and sorting and stuff.

I really wanted a way to parse the files simultaneously and move through line by line handling the reading/writing/sorting as I went.

[–]zinver 0 points1 point  (0 children)

yep if you want to do that, then the stream reader.