If you have server logs, use Excel for a quick look at details of individual visits
This question just came up on the Webtrends forum and I thought I’d share a quick way to look at individual visits, using Excel plus SDC logs.
Note that I said “using logs.” This is the raw data that Webtrends processes when it does the aggregation that it was designed for. If you use OnDemand, you have to ask Webtrends for the SDC logs. There’s a fee. If you use OnPremises, you have server logs (IIS or Apache logs) or you have SDC logs. Somewhere.
These instructions work for SDC logs. These instructions also assume the logs contain no more than one day of data (if more, you’ll have to change the sorting to keep the days from mingling). And I’m also assuming your logs aren’t too huge. Excel can choke.
So … here are instructions for a quick and dirty sorting into visits. If anybody finds it useful, let me know and I’ll come back and add some screen shots.
It seems endless, but that’s because I’m listing every little step. It really will take only about a minute of actual work, not counting waiting time while Excel works or the time spent reading the instructions.
- Open Excel
- File >> Open
- Browse to your log file and select it
- The Text Import Wizard will open:
- Choose Delimited, then Next
- Choose Space; leave everything else as is, then Next, then Finish
- Wait while Excel reads and opens the log. If your log is too big for Excel, it will tell you so (but will load the log partially)
- I strongly recommend that you keep only the first few hundred thousand rows or so and delete the rest. You’ll reduce the chances of crashing Excel.
- Boom! About 20 columns of stuff will appear when Excel is done.
- Delete the first four rows; they will be #Remark, #Software, #Version, and #Date. Keep the #Fields row.
- Delete the cell that says “#Fields:” and shift the rest of the row to the left. Right click on A1, choose Delete, then Shift Cells Left. This will put the right headings over the right columns.
- Make a new column that contains, for each row, both the IP address and the User Agent string, as follows:
- Go to row 1 in column S (the first empty column) and enter this formula: “=concatenate(C1,L1)” and hit Enter.
- The cell should now contain this: “c-ipcs(User-Agent)”
- Click on that cell to highlight it, then hover over the lower right corner of the highlighted cell where there is a very small black square. The cursor will change to a +. Double-click.
- Column S should now auto-fill downwards with a concatenation of the IP and user agent string. Don’t worry about reading and understanding these. The point is that these are probably (but not 100% of the time) each unique to an individual visitor, which is what you are after.
- Highlight all columns (A-S), then open the Data tab and choose Sort. The Sort dialog box will open.
- Make sure the box at the upper right is checked (“My data has headers)
- Click on the “Sort by” dropdown and choose the very last item, which will be “c-ipcs(User-Agent)”
- Click on Add Level to get another sort config line
- Click on the “Then by” dropdown and choose “Time”
- Click on OK and wait for the sorting.
- You now have your visits, with all the hits in each visit sorted by time from first to last.
- You’ll want to make it a little more intelligible by putting a divider line between individual visits, as follows:
- Highlight your block. I do it by clicking on A1, then Ctrl-Shift-DownArrow, then Ctrl-Shift-RightArrow.
- Assuming you are still in the Data tab, select Subtotal
- The Subtotal dialog box will open. Fill it in as follows:
- “At each change in:” open the dropdown and choose the very last item, which will be “c-ipcs(User-Agent)”
- “Use function:” Count
- “Add subtotal to:” check the box for c-ipcs(User-Agent) which, again, will be at the very end
- Leave Replace current subtotals and Summary below data checked
- Click on OK and wait. There’s a progress bar in the status line at the bottom if you feel panicky.
- Excel has inserted a new row between “visits” and also added some controls over in the left margin, labeled 1,2,3. Click on 2.
- Excel is now showing you only the inserted rows. The block should still be highlighted. Don’t worry, the rest of the data is still there. Look at the row numbers over on the left if you’re nervous; you’ll see lots of missing numbers.
- Click Alt-semicolon (Alt-;) and the screen will change subtly. You’ve just selected only the visible cells.
- Click on the Paint Can to color all these rows, for example black
- Go back to the controls “1,2,3” on the left and click on 3.
- Excel is now showing you all rows, with a colored divider row between “visits.”
- At this point, I usually move everything to a new sheet to get rid of the underlying mechanics, as follows:
- Highlight the block
- Copy to Clipboard (I always just use Ctrl-C)
- Open a new sheet, select A1, then paste (Ctrl-V)
- Delete column S if you like
- Go back and delete the sheet you were just on
Now you’re ready to look at individual visits line by line, in the order in which they occurred in the visit. You’ll probably want to concentrate on columns G and H, which are the URL stem and the URL query parameters for each hit. Have fun, or good luck … whichever applies.
A few notes:
- If the same “person” had two visits, they will be jammed together in chronological order. Keep an eye on the Time column. If there’s more than 30 minutes between one hit and the next, Webtrends is probably seeing this activity as two visits.
- You’ll see a lot of visits with nothing in the Cookie field on the first hit. These are first-time visits. Don’t worry, Webtrends sorts it out just fine when it analyzes. Using the IP-User Agent method is a quick-dirty way to get around the complexity of cookies (which are, in fact, in the Query Parameters and not in the so-called cs(Cookie) field of the logs.
- Sometimes SDC hits are virtually simultaneous, i.e. two hits happen in the same second of time. It’s possible that Excel will sort those two hits into the wrong order (it doesn’t know any better; hh:mm:ss is all it has to work with).
- If you want to get fancy with logs, download Microsoft Log Parser and learn how to use it.