Get-LMLogMessage
Syntax
Section titled “Syntax”Range-Async (Default)
Section titled “Range-Async (Default)”Get-LMLogMessage [-Query <string>] [-Range <string>] [-BatchSize <int>] [-MaxPages <int>] [-Async] [<CommonParameters>]Date-Async
Section titled “Date-Async”Get-LMLogMessage -StartDate <datetime> -EndDate <datetime> [-Query <string>] [-BatchSize <int>] [-MaxPages <int>] [-Async] [<CommonParameters>]Date-Sync
Section titled “Date-Sync”Get-LMLogMessage -StartDate <datetime> -EndDate <datetime> [-Query <string>] [-BatchSize <int>] [<CommonParameters>]Range-Sync
Section titled “Range-Sync”Get-LMLogMessage [-Query <string>] [-Range <string>] [-BatchSize <int>] [<CommonParameters>]Description
Section titled “Description”The Get-LMLogMessage function retrieves log messages from LogicMonitor based on specified time ranges or date ranges. It supports both synchronous and asynchronous queries with pagination control.
Examples
Section titled “Examples”EXAMPLE 1
Section titled “EXAMPLE 1”#Retrieve logs for a specific date rangeGet-LMLogMessage -StartDate (Get-Date).AddDays(-1) -EndDate (Get-Date)EXAMPLE 2
Section titled “EXAMPLE 2”#Retrieve logs asynchronously with a custom queryGet-LMLogMessage -Range "1hour" -Query "error" -AsyncParameters
Section titled “Parameters”-Async
Section titled “-Async”Switch to enable asynchronous query mode.
Type: System.Management.Automation.SwitchParameterDefaultValue: FalseSupportsWildcards: falseAliases: []ParameterSets:- Name: Range-Async Position: Named IsRequired: false ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: false- Name: Date-Async Position: Named IsRequired: false ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: falseDontShow: falseAcceptedValues: []HelpMessage: ''-BatchSize
Section titled “-BatchSize”The number of results to return per request. Must be between 1 and 300. Defaults to 300.
Type: System.Int32DefaultValue: 300SupportsWildcards: falseAliases: []ParameterSets:- Name: (All) Position: Named IsRequired: false ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: falseDontShow: falseAcceptedValues: []HelpMessage: ''-EndDate
Section titled “-EndDate”The end date for retrieving log messages. Required for Date parameter sets.
Type: System.DateTimeDefaultValue: ''SupportsWildcards: falseAliases: []ParameterSets:- Name: Date-Async Position: Named IsRequired: true ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: false- Name: Date-Sync Position: Named IsRequired: true ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: falseDontShow: falseAcceptedValues: []HelpMessage: ''-MaxPages
Section titled “-MaxPages”The maximum number of pages to retrieve in async mode. Defaults to 10.
Type: System.Int32DefaultValue: 10SupportsWildcards: falseAliases: []ParameterSets:- Name: Range-Async Position: Named IsRequired: false ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: false- Name: Date-Async Position: Named IsRequired: false ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: falseDontShow: falseAcceptedValues: []HelpMessage: ''-Query
Section titled “-Query”A query string to filter the log messages.
Type: System.StringDefaultValue: ''SupportsWildcards: falseAliases: []ParameterSets:- Name: (All) Position: Named IsRequired: false ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: falseDontShow: falseAcceptedValues: []HelpMessage: ''-Range
Section titled “-Range”The time range for retrieving log messages. Valid values are “15min”, “30min”, “1hour”, “3hour”, “6hour”, “12hour”, “24hour”, “3day”, “7day”, “1month”. Defaults to “15min”.
Type: System.StringDefaultValue: 15minSupportsWildcards: falseAliases: []ParameterSets:- Name: Range-Async Position: Named IsRequired: false ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: false- Name: Range-Sync Position: Named IsRequired: false ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: falseDontShow: falseAcceptedValues: []HelpMessage: ''-StartDate
Section titled “-StartDate”The start date for retrieving log messages. Required for Date parameter sets.
Type: System.DateTimeDefaultValue: ''SupportsWildcards: falseAliases: []ParameterSets:- Name: Date-Async Position: Named IsRequired: true ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: false- Name: Date-Sync Position: Named IsRequired: true ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: falseDontShow: falseAcceptedValues: []HelpMessage: ''CommonParameters
Section titled “CommonParameters”This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.