Skip to content

Get-LMAuditLogs

Syntax

Range (Default)

Terminal window
Get-LMAuditLogs [-SearchString <String>] [-StartDate <DateTime>] [-EndDate <DateTime>] [-BatchSize <Int32>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]

Id

Terminal window
Get-LMAuditLogs [-Id <String>] [-BatchSize <Int32>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

Filter

Terminal window
Get-LMAuditLogs [-Filter <Object>] [-BatchSize <Int32>] [-ProgressAction <ActionPreference>]
[<CommonParameters>]

Description

The Get-LMAuditLogs 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.

Examples

Example 1

Terminal window
#Retrieve audit logs from the last week
Get-LMAuditLogs -StartDate (Get-Date).AddDays(-7)

Example 2

Terminal window
#Search for specific audit logs
Get-LMAuditLogs -SearchString "login" -StartDate (Get-Date).AddDays(-30)

Parameters

-Id

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

Type: String
Parameter Sets: Id
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-SearchString

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

Type: String
Parameter Sets: Range
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-StartDate

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

Type: DateTime
Parameter Sets: Range
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-EndDate

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

Type: DateTime
Parameter Sets: Range
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Filter

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

Type: Object
Parameter Sets: Filter
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-BatchSize

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

Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 1000
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

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.

Inputs

None. You cannot pipe objects to this command.

Outputs

Returns LogicMonitor.AuditLog objects.

Notes

You must run Connect-LMAccount before running this command. Maximum of 10000 logs can be retrieved in a single query.