Send-LMLogMessage
Syntax
SingleMessage
Send-LMLogMessage -Message <String> [-Timestamp <String>] -resourceMapping <Hashtable> [-Metadata <Hashtable>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
MessageList
Send-LMLogMessage -MessageArray <Object> [-ProgressAction <ActionPreference>] [<CommonParameters>]
Description
The Send-LMLogMessage function sends log messages to LogicMonitor for logging and monitoring purposes. It supports sending a single message or an array of messages.
Examples
Example 1
Send-LMLogMessage -Message "This is a test log message" -resourceMapping @{ 'system.deviceId' = '12345' } -Metadata @{ 'key1' = 'value1' }Sends a single log message with the specified message, resource mapping, and metadata.
Example 2
Send-LMLogMessage -MessageArray $MessageObjectsArraySends an array of log message objects.
Parameters
-Message
Specifies the log message to send. This parameter is mandatory when using the ‘SingleMessage’ parameter set.
Type: StringParameter Sets: SingleMessageAliases:
Required: TruePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-Timestamp
Specifies the timestamp for the log message. If not provided, the current UTC timestamp will be used. This parameter is mandatory when using the ‘SingleMessage’ parameter set.
Type: StringParameter Sets: SingleMessageAliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-resourceMapping
Specifies the resource mapping for the log message. This parameter is mandatory when using the ‘SingleMessage’ parameter set.
Type: HashtableParameter Sets: SingleMessageAliases:
Required: TruePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-Metadata
Specifies additional metadata to include with the log message. This parameter is optional when using the ‘SingleMessage’ parameter set.
Type: HashtableParameter Sets: SingleMessageAliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-MessageArray
Specifies an array of log messages to send. This parameter is mandatory when using the ‘MessageList’ parameter set.
Type: ObjectParameter Sets: MessageListAliases:
Required: TruePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-ProgressAction
Fill ProgressAction Description
Type: ActionPreferenceParameter Sets: (All)Aliases: proga
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept 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.