Skip to content

Get-LMAuditLog

Terminal window
Get-LMAuditLog [-SearchString <string>] [-StartDate <datetime>] [-EndDate <datetime>]
[-BatchSize <int>] [<CommonParameters>]
Terminal window
Get-LMAuditLog [-Id <string>] [-BatchSize <int>] [<CommonParameters>]
Terminal window
Get-LMAuditLog [-Filter <Object>] [-BatchSize <int>] [<CommonParameters>]

The Get-LMAuditLog function retrieves audit logs from LogicMonitor based on the specified parameters. It supports retrieving logs by ID, by date range, or by applying filters. The function can retrieve up to 10000 logs in a single query.

Terminal window
#Retrieve audit logs from the last week
Get-LMAuditLog -StartDate (Get-Date).AddDays(-7)
Terminal window
#Search for specific audit logs
Get-LMAuditLog -SearchString "login" -StartDate (Get-Date).AddDays(-30)

The number of results to return per request. Must be between 1 and 1000. Defaults to 1000.

Type: System.Int32
DefaultValue: 1000
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

The end date for retrieving audit logs. Defaults to current time if not specified.

Type: System.DateTime
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Range
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

A filter object to apply when retrieving audit logs. Part of a mutually exclusive parameter set.

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Filter
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

The ID of the specific audit log to retrieve. This parameter is part of a mutually exclusive parameter set.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Id
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

A string to filter audit logs by. Only logs containing this string will be returned.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Range
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

The start date for retrieving audit logs. Defaults to 30 days ago if not specified.

Type: System.DateTime
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Range
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

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.