Using relog: Creating a smaller file

 

Today I had to remember the steps for using relog. If you’ve never heard of relog, stay with me. It’s a tool for merging PerfMon files, and also for extracting smaller data sets from Perfmon. I still love PerfMon friends, I admit it. It’s been a staple for understanding performance on a Windows Server since I’ve started in IT. But I haven’t used relog in forever so I completely forgot the commands I needed.

The problem

I provided a PerfMon template to a customer a few weeks ago and asked them to start capturing data.  I requested that they roll over the file daily, but that request got lost in the shuffle.  They manually stopped and restarted the data collector intermittently, so when they sent me the file to review data from an issue they had over the weekend, it was almost 5GB in size.  Oof.  I loathe opening large PerfMon files in the UI because it takes a long to load.  This is where using relog came in because I only needed to look at about an hour’s worth of data.

Finding the command I needed

I did a quick Google search looking for the syntax, and landed on a post from my friend Andy Galbraith, Handling Perfmon Logs with Relog.  It’s a useful post if you want to merge multiple files, and I recommend it if you need that.  I needed to separate out my data.

My very first SQL Server presentation was on the topic of baselines, and I used to demo relog.  I had to have the code somewhere right?  Nope.  I did find my old presentation and wow…that needs updating.  Then I searched my old blog and found a post where I had the syntax.  Yay past me!

However, no one else would ever find that post so I thought I’d share the syntax here.  Also, if you go to the official relog documentation the syntax is there, but it’s not quite correct.

Using relog to extract data based on a date range

The parameters are -b for begin time and -e for end time.  And for both parameters the documentation states:

Date syntax for -b and -e
Date syntax for -b and -e

 

Do you see a space between the year and the hour?  Me neither.  This syntax fails:

relog SQLskills_DataCollector.blg -b 3/21/202019:00:00 -e 3/21/202020:00:00 -o SQLskills_March21.blg

relog error with no space between date and time
relog error with no space between date and time

 

But if I add a space between the date and the time:

relog SQLskills_DataCollector.blg -b 3/21/2020 19:00:00 -e 3/21/2020 20:00:00 -o SQLskills_March21.blg

It works:

correct relog command
correct relog command

 

And with that, I’m off to analyze some data!

 

Other articles

How was a plan forced?

If you use Automatic Plan Correction, and thus also Query Store, you may wonder how was a plan forced: manually or automatically with APC?  The

Explore

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.