PowerShell module for accessing the LogicMonitor REST API.
This project is also published in the PowerShell Gallery at https://www.powershellgallery.com/packages/Logic.Monitor/.
Check out the full Logic.Monitor module documenation at: https://logicmonitor.github.io/lm-powershell-module-docs/
Community Contribution Notice: This PowerShell module is an open-source project created and maintained by LogicMonitor users. While not an official LogicMonitor product, it's designed by people who use and understand the platform.
The module is freely available for everyone to use, modify, and improve. We welcome your feedback and contributions! If you have ideas or encounter any issues, please share them through GitHub issues or pull requests.
Many community members rely on this module in their daily operations. Though we can't offer formal support guarantees, our collaborative community strives to address questions and continuously enhance functionality.
We hope you find this tool valuable for your LogicMonitor workflows!
- From PowerShell Gallery:
Install-Module -Name "Logic.Monitor"
- New releases are published often, to ensure you have the latest version you can run:
Update-Module -Name "Logic.Monitor"
Before you can use on module commands you will need to be connected to a LM portal. To connect your LM portal use the Connect-LMAccount command:
Connect-LMAccount -AccessId "lm_access_id" -AccessKey "lm_access_key" -AccountName "lm_portal_prefix_name"
Once connected you can then run an appropriate command, a full list of commands available can be found using:
Get-Command -Module "Logic.Monitor"
To disconnect from an account simply run the Disconnect-LMAccount command:
Disconnect-LMAccount
To cache credentials for multiple portals you can use the command New-LMCachedAccount, once a credential has been cached you can reference it when connecting to an lm portal using the -UserCachedCredentials switch in Connect-LMAccount.
Cached credentials are stored in a LocalVault using Microsoft's SecretManagement module. If its your first time using SecretManagement you will be prompted to set up a password for accessing your cached accounts in the LocalVault using this method.
New-LMCachedAccount -AccessId "lm_access_id" -AccessKey "lm_access_key" -AccountName "lm_portal_prefix_name"
Connect-LMAccount -UseCachedCredential
#Example output when using cached credentials
#Selection Number | Portal Name
#0) portalname
#1) portalnamesandbox
#Enter the number for the cached credential you wish to use: 1
#Connected to LM portal portalnamesandbox using account
- Remove-LMDeviceGroupProperty: Added pipeline support for passing DeviceGroup objects to this cmdlet for processing.
- Set-LMDeviceGroupProperty: Cmdlet to update the value of a custom property assigned to a device group. Cmdlet takes a -Id or -Name of the device group to be updated along with a -PropertyName and -PropertyValue. This cmdlet has pipeline support for DeviceGroup objects.
- New-LMDeviceGroupProperty: Cmdlet to remove the value of a custom property assigned to a device group. Cmdlet takes a -Id or -Name of the device group to be updated along with a -PropertyName that is to be deleted. This cmdlet has pipeline support for DeviceGroup objects.
- -Filter Parameter: Fixed an issue that caused an invalid filter error when trying to use filters that contain special reserved characters such as ()$&#[].
- Connect-LMAccount: Added beta support for LM GovCloud tenants. To connect to a GovCloud instance use the -GovCloud switch when connecting. All existing cmdlets have been updated to support GovCloud portals but not all features in Commercial tenants are available in GovCloud.
- Get-LMLogPartition: Retrieves details of existing log partitions.
- Get-LMLogPartitionRetention: Gets the available retention policies for a portal.
- Set-LMLogPartition: Modifies the settings of specified log partitions. Available parameters include Sku, Rentention, Status and Description.
- Set-LMLogPartitionAction: Updates a log partition to resume or pause log ingest.
- New-LMLogPartition: Creates new log partition for log management.
- Remove-LMLogPartition: Deletes specified log partitions from the system. A log partition must have ingest disabled for 24 hours before it can be removed.
#Retrieve a specific log partition by name
Get-LMLogPartition -Name "customerA"
#Get a log partition and update its description and disable ingest
Get-LMLogPartition -Name "CustomerB" | Set-LMLogPartition -Description "Offboarded 5/5/25" -Debug -Status inactive
#Remove a disabled log partition
Remove-LMLogPartition -Name "CustomerB" -Confirm:$false
#Resume log ingestion
Set-LMLogPartitionAction -Name "CustomerC" -Action "resume"
- API Headers: Updated all API request headers to use a custom User-Agent (Logic.Monitor-PowerShell-Module/Version) for usage reporting on versions deployed.
We're excited to announce our new comprehensive documentation site at https://logicmonitor.github.io/lm-powershell-module-docs/. The site includes:
- Detailed command reference information
- Code examples and snippets
- Best practices guides
Introducing the Filter Wizard, a new interactive tool to help build complex filters:
- Visual filter construction
- Support for all filter operators
- Real-time filter preview
- Available through
Build-LMFilter
or-FilterWizard
parameter
# Use the standalone filter builder
Build-LMFilter
# Use built-in filter wizard parameter
Get-LMDeviceGroup -FilterWizard
Copyright, 2024, LogicMonitor, Inc.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.