The SumoLogic PowerShell module is for using PowerShell to manage collectors/sources, upgrade collectors, and search logs with SumoLogic API This is a community-supported PowerShell module, free and open sourced; subject to the terms of the Apache 2.0 license.
- Create a SumoLogic free account if you currently don't have one.
- Create an access Id/Key pair following this instruction
- Record the access Id/Key; they will be used to authenticate to SumoLogic web service when creating session.
- With Windows PowerShell 5.0+ (on Windows), or
- Install PowerShell Core 6.0 or higher.
- Install module:
# Download and install remotely from PowerShell Gallery
Install-Module -Name SumoLogic-Core
Get-Help Get-Collector -Full # Get help and samples for cmdlets
Before calling any API function, you need to setup a SumoSession
and store it into current PowerShell session
$cred = Get-Credential # Following the prompt, input access ID as User and access Key as Password
New-SumoSession -Credential $cred # This cmdlet will try to use the access Key/ID to connect to correct deployment
# You can also using string to pass access Key/Id as following, but it is not recommended since it will expose the access key as plain text
$accessId = "<access key>"
$accessKeyAsSecureString = ConvertTo-SecureString "<access Id>" -AsPlainText -Force
New-SumoSession -AccessId $accessId -AccessKeyAsSecureString $accessKeyAsSecureString | Out-Null
# If necessary, using a specific API endpoint with environment variable
$env:SUMOLOGIC_API_ENDPOINT="https://api.de.sumologic.com/api/v1/"
NOTE:
- If you want specific the deployment to connect, set environment variable
SUMOLOGIC_API_ENDPOINT
as the value of "API endpoint" in this page. - You can also store the
SumoSession
into a variable and call following cmdlets with the parameterSumoAPISession
for switching context between different deployments/accounts
Get-Command -Module SumoLogic-Core # Navigate all commands in the module
Get-Collector # For example, Query all collectors in current account
Report any issue or idea through Github
Sumo Logic only accepts connections from clients using TLS version 1.2 or greater. To utilize the content of this repo, ensure that it's running in an execution environment that is configured to use TLS 1.2 or greater.