< Back
Invoke-DbaPfRelog
Post
NAME Invoke-DbaPfRelog
SYNOPSIS
Pipeline-compatible wrapper for the relog command which is available on modern Windows platforms.
SYNTAX
Invoke-DbaPfRelog [[-Path] <System.String[]>] [[-Destination] <String>] [[-Type] <String>] [-Append <Switch>]
[-AllowClobber <Switch>] [[-PerformanceCounter] <System.String[]>] [[-PerformanceCounterPath] <String>]
[[-Interval] <Int>] [[-BeginTime] <Datetime>] [[-EndTime] <Datetime>] [[-ConfigPath] <String>] [-Summary <Switch>]
[[-InputObject] <System.Object[]>] [-Multithread <Switch>] [-AllTime <Switch>] [-Raw <Switch>] [-EnableException
<Switch>] [<CommonParameters>]
DESCRIPTION
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.
PARAMETERS
-AllowClobber [<Switch>]
If this switch is enabled, the destination file will be overwritten if it exists.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-AllTime [<Switch>]
If this switch is enabled and a datacollector or datacollectorset is passed in via the pipeline, collects all
logs, not just the latest.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Append [<Switch>]
If this switch is enabled, output will be appended to the specified file instead of overwriting. This option
does not apply to SQL format where the default is always to append.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-BeginTime [<Datetime>]
This is is Get-Date object and we format it for you.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-ConfigPath [<String>]
Specifies the pathname of the settings file that contains command-line parameters.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Destination [<String>]
Specifies the pathname of the output file or SQL database where the counters will be written. Defaults to the
same directory as the source.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EnableException [<Switch>]
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables
advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own
try/catch.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EndTime [<Datetime>]
Specifies end time for copying last record from the input file. This is is Get-Date object and we format it
for you.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-InputObject [<System.Object[]>]
Accepts the output of Get-DbaPfDataCollector and Get-DbaPfDataCollectorSet as input via the pipeline.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Interval [<Int>]
Specifies sample intervals in "n" records. Includes every nth data point in the relog file. Default is every
data point.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Multithread [<Switch>]
If this switch is enabled, processing will be done in parallel. This may speed up large batches or large files.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Path [<System.String[]>]
Specifies the pathname of an existing performance counter log or performance counter path. You can specify
multiple input files.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-PerformanceCounter [<System.String[]>]
Specifies the performance counter path to log.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-PerformanceCounterPath [<String>]
Specifies the pathname of the text file that lists the performance counters to be included in a relog file.
Use this option to list counter paths in an input file, one per line. Default setting is all counters in the
original log file are relogged.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Raw [<Switch>]
If this switch is enabled, the results of the DOS command instead of Get-ChildItem will be displayed. This
does not run in parallel.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Summary [<Switch>]
If this switch is enabled, the performance counters and time ranges of log files specified in the input file
will be displayed.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Type [<String>]
The output format. Defaults to tsv. Options include tsv, csv, bin, and sql.
For a SQL database, the output file specifies the DSN!counter_log. You can specify the database location by
using the ODBC manager to configure the DSN (Database System Name).
For more information, read here: https://technet.microsoft.com/en-us/lib ... 90958.aspx
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: Performance, DataCollector, PerfCounter, Relog
Author: Chrissy LeMaire (@cl), netnerds.net
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Invoke-DbaPfRelog -Path C:\\temp\\perfmon.blg
Creates C:\\temp\\perfmon.tsv from C:\\temp\\perfmon.blg.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Invoke-DbaPfRelog -Path C:\\temp\\perfmon.blg -Destination C:\\temp\\a\\b\\c
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.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-DbaPfDataCollectorSet -ComputerName sql2016 | Get-DbaPfDataCollector | Invoke-DbaPfRelog -Destination
C:\\temp\\perf
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.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Invoke-DbaPfRelog -Path C:\\temp\\perfmon.blg -Destination C:\\temp\\a\\b\\c -Raw
```
[Invoke-DbaPfRelog][21:21:35] relog "C:\\temp\\perfmon.blg" -f csv -o C:\\temp\\a\\b\\c
Input
----------------
File(s):
C:\\temp\\perfmon.blg (Binary)
Begin: 1/13/2018 5:13:23
End: 1/13/2018 14:29:55
Samples: 2227
100.00%
Output
----------------
File: C:\\temp\\a\\b\\c.csv
Begin: 1/13/2018 5:13:23
End: 1/13/2018 14:29:55
Samples: 2227
The command completed successfully.
```
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.
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>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))
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.
-------------------------- EXAMPLE 6 --------------------------
PS C:\\>$servers | Get-DbaPfDataCollectorSet | Get-DbaPfDataCollector | Invoke-DbaPfRelog -Multithread -AllowClobber
Relogs latest data files from all collectors within the servers listed in $servers.
-------------------------- EXAMPLE 7 --------------------------
PS C:\\>Get-DbaPfDataCollector -Collector DataCollector01 | Invoke-DbaPfRelog -AllowClobber -AllTime
Relogs all the log files from the DataCollector01 on the local computer and allows overwrite.
RELATED LINKS
https://dbatools.io/Invoke-DbaPfRelog
SYNOPSIS
Pipeline-compatible wrapper for the relog command which is available on modern Windows platforms.
SYNTAX
Invoke-DbaPfRelog [[-Path] <System.String[]>] [[-Destination] <String>] [[-Type] <String>] [-Append <Switch>]
[-AllowClobber <Switch>] [[-PerformanceCounter] <System.String[]>] [[-PerformanceCounterPath] <String>]
[[-Interval] <Int>] [[-BeginTime] <Datetime>] [[-EndTime] <Datetime>] [[-ConfigPath] <String>] [-Summary <Switch>]
[[-InputObject] <System.Object[]>] [-Multithread <Switch>] [-AllTime <Switch>] [-Raw <Switch>] [-EnableException
<Switch>] [<CommonParameters>]
DESCRIPTION
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.
PARAMETERS
-AllowClobber [<Switch>]
If this switch is enabled, the destination file will be overwritten if it exists.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-AllTime [<Switch>]
If this switch is enabled and a datacollector or datacollectorset is passed in via the pipeline, collects all
logs, not just the latest.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Append [<Switch>]
If this switch is enabled, output will be appended to the specified file instead of overwriting. This option
does not apply to SQL format where the default is always to append.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-BeginTime [<Datetime>]
This is is Get-Date object and we format it for you.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-ConfigPath [<String>]
Specifies the pathname of the settings file that contains command-line parameters.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Destination [<String>]
Specifies the pathname of the output file or SQL database where the counters will be written. Defaults to the
same directory as the source.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EnableException [<Switch>]
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables
advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own
try/catch.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EndTime [<Datetime>]
Specifies end time for copying last record from the input file. This is is Get-Date object and we format it
for you.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-InputObject [<System.Object[]>]
Accepts the output of Get-DbaPfDataCollector and Get-DbaPfDataCollectorSet as input via the pipeline.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Interval [<Int>]
Specifies sample intervals in "n" records. Includes every nth data point in the relog file. Default is every
data point.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Multithread [<Switch>]
If this switch is enabled, processing will be done in parallel. This may speed up large batches or large files.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Path [<System.String[]>]
Specifies the pathname of an existing performance counter log or performance counter path. You can specify
multiple input files.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-PerformanceCounter [<System.String[]>]
Specifies the performance counter path to log.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-PerformanceCounterPath [<String>]
Specifies the pathname of the text file that lists the performance counters to be included in a relog file.
Use this option to list counter paths in an input file, one per line. Default setting is all counters in the
original log file are relogged.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Raw [<Switch>]
If this switch is enabled, the results of the DOS command instead of Get-ChildItem will be displayed. This
does not run in parallel.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Summary [<Switch>]
If this switch is enabled, the performance counters and time ranges of log files specified in the input file
will be displayed.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Type [<String>]
The output format. Defaults to tsv. Options include tsv, csv, bin, and sql.
For a SQL database, the output file specifies the DSN!counter_log. You can specify the database location by
using the ODBC manager to configure the DSN (Database System Name).
For more information, read here: https://technet.microsoft.com/en-us/lib ... 90958.aspx
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: Performance, DataCollector, PerfCounter, Relog
Author: Chrissy LeMaire (@cl), netnerds.net
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Invoke-DbaPfRelog -Path C:\\temp\\perfmon.blg
Creates C:\\temp\\perfmon.tsv from C:\\temp\\perfmon.blg.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Invoke-DbaPfRelog -Path C:\\temp\\perfmon.blg -Destination C:\\temp\\a\\b\\c
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.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-DbaPfDataCollectorSet -ComputerName sql2016 | Get-DbaPfDataCollector | Invoke-DbaPfRelog -Destination
C:\\temp\\perf
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.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Invoke-DbaPfRelog -Path C:\\temp\\perfmon.blg -Destination C:\\temp\\a\\b\\c -Raw
```
[Invoke-DbaPfRelog][21:21:35] relog "C:\\temp\\perfmon.blg" -f csv -o C:\\temp\\a\\b\\c
Input
----------------
File(s):
C:\\temp\\perfmon.blg (Binary)
Begin: 1/13/2018 5:13:23
End: 1/13/2018 14:29:55
Samples: 2227
100.00%
Output
----------------
File: C:\\temp\\a\\b\\c.csv
Begin: 1/13/2018 5:13:23
End: 1/13/2018 14:29:55
Samples: 2227
The command completed successfully.
```
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.
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>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))
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.
-------------------------- EXAMPLE 6 --------------------------
PS C:\\>$servers | Get-DbaPfDataCollectorSet | Get-DbaPfDataCollector | Invoke-DbaPfRelog -Multithread -AllowClobber
Relogs latest data files from all collectors within the servers listed in $servers.
-------------------------- EXAMPLE 7 --------------------------
PS C:\\>Get-DbaPfDataCollector -Collector DataCollector01 | Invoke-DbaPfRelog -AllowClobber -AllTime
Relogs all the log files from the DataCollector01 on the local computer and allows overwrite.
RELATED LINKS
https://dbatools.io/Invoke-DbaPfRelog