commands

^

New-DbaXESmartCsvWriter

Author Chrissy LeMaire (@cl) , SmartTarget by Gianluca Sartori (@spaghettidba)
Availability Windows, Linux, macOS

 

Synopsis

This response type is used to write Extended Events to a CSV file.

Description

This response type is used to write Extended Events to a CSV file.

Syntax

New-DbaXESmartCsvWriter
    [-OutputFile] <String>
    [-Overwrite]
    [[-Event] <String[]>]
    [[-OutputColumn] <String[]>]
    [[-Filter] <String>]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> $columns = "cpu_time", "duration", "physical_reads", "logical_reads", "writes", "row_count"
PS C:\> $response = New-DbaXESmartCsvWriter -OutputFile c:\temp\workload.csv -OutputColumn $columns -OverWrite -Event "sql_batch_completed"
PS C:\> Start-DbaXESmartTarget -SqlInstance localhost\sql2017 -Session "Profiler Standard" -Responder $response

Writes Extended Events to the file "C:\temp\workload.csv".

Required Parameters

-OutputFile

Specifies the path to the output CSV file.

Alias
Required True
Pipeline false
Default Value

Optional Parameters

-Overwrite

Specifies whether any existiting file should be overwritten or not.

Alias
Required False
Pipeline false
Default Value False
-Event

Specifies a list of events to be processed (with others being ignored. By default, all events are processed.

Alias
Required False
Pipeline false
Default Value
-OutputColumn

Specifies the list of columns to output from the events. XESmartTarget will capture in memory and write to the target table only the columns (fields or targets) that are present in this list. Fields and actions are matched in a case-sensitive manner. Expression columns are supported. Specify a column with ColumnName AS Expression to add an expression column (Example: Total AS Reads + Writes)

Alias
Required False
Pipeline false
Default Value
-Filter

Specifies a filter expression in the same form as you would use in the WHERE clause of a SQL query. Example: duration > 10000 AND cpu_time > 10000

Alias
Required False
Pipeline false
Default Value
-EnableException

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.

Alias
Required False
Pipeline false
Default Value False
-WhatIf

If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.

Alias wi
Required False
Pipeline false
Default Value
-Confirm

If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.

Alias cf
Required False
Pipeline false
Default Value

 

Want to see the source code for this command? Check out New-DbaXESmartCsvWriter on GitHub.
Want to see the Bill Of Health for this command? Check out New-DbaXESmartCsvWriter.