dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Invoke-DbaPfRelog

Pipeline-compatible wrapper for the relog command. Relog is useful for converting Windows Perfmon.

Extracts performance counters from performance counter logs into other formats, such as text-TSV (for tab-delimited text), text-CSV (for comma-delimited text), binary-BIN, or SQL.

relog “C:\PerfLogs\Admin\System Correlation\WORKSTATIONX_20180112-000001\DataCollector01.blg” -o C:\temp\foo.csv -f tsv

If you find any input hangs, please send us the output so we can accommodate for it then use -Raw for an immediate solution.

Screenshots

dbatools-Invoke-DbaPfRelog

Examples

Creates C:\temp\perfmon.tsv from C:\temp\perfmon.blg.

Invoke-DbaPfRelog -Path C:\temp\perfmon.blg

Creates the temp, a, and b directories if needed, then generates c.tsv (tab separated) from C:\temp\perfmon.blg.
Returns the newly created file as a file object.

Invoke-DbaPfRelog -Path C:\temp\perfmon.blg -Destination C:\temp\a\b\c

Creates C:\temp\perf if needed, then generates computername-datacollectorname.tsv (tab separated) from the latest logs of all data collector sets on sql2016. This destination format was chosen to avoid naming conflicts with piped input.

Get-DbaPfDataCollectorSet -ComputerName sql2016 | Get-DbaPfDataCollector | Invoke-DbaPfRelog -Destination C:\temp\perf

Creates the temp, a, and b directories if needed, then generates c.tsv (tab separated) from C:\temp\perfmon.blg then outputs the raw results of the relog command.

Invoke-DbaPfRelog -Path C:\temp\perfmon.blg -Destination C:\temp\a\b\c -Raw

Creates the temp, a, and b directories if needed, then generates c.csv (comma separated) from C:\temp\perflog with spaces.blg’, starts 30 days ago and ends one day ago.

Invoke-DbaPfRelog -Path ‘C:\temp\perflog with spaces.blg’ -Destination C:\temp\a\b\c -Type csv -BeginTime ((Get-Date).AddDays(-30)) -EndTime ((Get-Date).AddDays(-1))

Relogs latest data files from all collectors within the servers listed in $servers.

$servers | Get-DbaPfDataCollectorSet | Get-DbaPfDataCollector | Invoke-DbaPfRelog -Multithread -AllowClobber

Relogs all the log files from the DataCollector01 on the local computer and allows overwrite.

Get-DbaPfDataCollector -Collector DataCollector01 | Invoke-DbaPfRelog -AllowClobber -AllTime

Author

This command was created by Chrissy LeMaire. You can find Chrissy on Twitter.

Get-Help

From PowerShell, execute Get-Help Invoke-DbaPfRelog -Detailed for more information on this function.

Source Code

Want to see the source code? View Invoke-DbaPfRelog.ps1 on GitHub
 

Related commands