ConvertTo-PodeSyslog
SYNOPSIS
Converts a log message to a syslog formatted string.
SYNTAX
ConvertTo-PodeSyslog [-Message] <Object> [-Level] <PodeLogLevel> [-Timestamp] <DateTime> [[-Facility] <Int32>]
[[-AppName] <String>] [[-Tags] <Hashtable>] [[-Format] <PodeSyslogFormat>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
Converts a log message to a syslog formatted string based on the specified parameters.
EXAMPLES
EXAMPLE 1
$msg = ConvertTo-PodeSyslog -Message "This is a test log message" -Level 'Info' -Timestamp (Get-Date) -Tags @{ Environment = "Production"; Version = "1.0" }
EXAMPLE 2
$msg = ConvertTo-PodeSyslog -Message "This is a test log message" -Level 'Error' -Timestamp (Get-Date) -Facility 16 -AppName "MyApp" -Tags @{ Environment = "Staging"; Version = "2.0" } -Format 'RFC3164'
PARAMETERS
-AppName
The name of the application generating the log message. (Default: the server's AppName)
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Facility
The syslog facility code. (Default: 16, which corresponds to local0 for web/app logs)
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: 16
Accept pipeline input: False
Accept wildcard characters: False
-Format
The syslog format to use. (Default: Server default, or 'RFC5424' if no default set)
Type: PodeSyslogFormat
Parameter Sets: (All)
Aliases:
Accepted values: RFC3164, RFC5424
Required: False
Position: 7
Default value: RFC5424
Accept pipeline input: False
Accept wildcard characters: False
-Level
The log level of the message.
Type: PodeLogLevel
Parameter Sets: (All)
Aliases:
Accepted values: Emergency, Alert, Critical, Error, Warning, Notice, Informational, Debug, Verbose
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Message
The log message to be converted.
Type: Object
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Tags
A hashtable of tags to include in the syslog message.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Timestamp
The timestamp of the log message.
Type: DateTime
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.