In my previous post (What I Learned Today - the RELOG utility) I discussed what I discovered the first time I learned about the RELOG utility. In this post I’ll continue with my education. Again, I’ve used Ask The Performance Team, Microsoft TechNet, and this blog post at My Torn Data Pages as my references.
I found that I could output a list of counters from a perfmon counter log using RELOG (RELOG counterfilename –q –o counterfilename). But you can take that a step further. Simply edit your counter file and delete the counters you don’t want. Then rerun RELOG and use the –cf switch to import a list of counters to filter for. My examples use the same counter log file as before:
RELOG SQL1_20100106.csv – q –o counters.txt -- to get my list of counters
RELOG SQL1_20100106.csv –cf counters.txt –c csv –o filtered1.csv -- to filter by those counters after editing the counters.txt file.
And of course I can still filter by time with the –b and –e switches:
RELOG SQL1_20100106.csv –cf counters.txt -b "1/5/2010 9:00:00AM" -e "1/5/2010 10:00:00 AM" –f csv -o filtered2.csv
You can save your settings in a config file…
…and use just the –config switch
RELOG SQL1_20100106.csv –config relogconfig.txt
Now there’s plenty of ways to filter your perfmon files. The last way is to save the results in a SQL database.
Inserting into a SQL database
The –o switch specifies where to output the results of a perfmon counter log file. You have the option to export to a flat file, which I’ve been doing so far, or directly to a database. And that’s simple. First, create a DSN pointing to the server and database of your choice. Stan Segers, whose blog I’ve been referencing at My Torn Data Pages, is correct in noting that you need to use the SQL Driver. Like Stan, I wasn’t able to connect if I chose the SQL Native Client. Then, when you use the –o switch, specify SQL: and the name of your DSN. In the example my counter name is Counters.
RELOG SQL1_20100106.csv –cf counters.txt –o:SQL:Counters
RELOG will create these 3 tables:
The tables are created the first time you run RELOG to that database. The utility generates a GUID for each run. Each time you run it it will insert records into the CounterDetails and CounterData tables. But it won’t insert into or update the DisplayToID table. So to keep a record of each time you run the utility, specify a different DisplayString. Everything after the exclamation point (!) is the string.
RELOG SQL1_20100106.csv –cf counters.txt –o:SQL:Counters!DCICHISQL1
I hope I’ve shown you ways to use the RELOG utility. As you can see, it’s pretty powerful.