ALTools
Tools required to send logs to Azure Logs
Install / Use
/learn @mczerniawski/ALToolsREADME
Build Status
|Build Status|Branch|
|---|---|
||master|
|
|dev|
Index
<!-- TOC -->- What is ALTools
- Installation
- How to Create Azure Log Worksapce
- How to Retrieve required information from existing Workspace
- Run Examples
What is ALTools
ALTools is a simple micro-module to interact with Azure Logs.
It is based on official Microsoft documentation.
In it's current state it is used to send custom PSObjects to Azure Logs.
Installation
ALTools module is available on PowerShell Gallery so installation is quite easy:
Install-Module ALTools
Examples
To send PowerShell Objects to Azure Logs you will first need to get WorkspaceID and PrimaryKey. Use this to get it.
Here are some examples of how to use this to send custom logs to Azure Logs
Current running processes
Send all files from given path Azure Logs:
Import-Module ALTools -Force
$invocationStartTime = [DateTime]::UtcNow
$object = Get-Process
$invocationEndTime = [DateTime]::UtcNow
$writeToLogAnalyticsSplat = @{
ALWorkspaceID = 'e2920363-xxxx-xxxx-xxxx-740exxxx801'
invocationStartTime = $invocationStartTime
PSObject = $object
ALTableIdentifier = 'ALTools' #Your name for Azure Logs
invocationEndTime = $invocationEndTime
WorkspacePrimaryKey = 'I5ZBxxxxxxxxxxxRkiy8uZ77rfTKKvzeI+g=='
}
Write-ToLogAnalytics @writeToLogAnalyticsSplat -Verbose
Files from disk
Send all current running processes to Azure Logs:
$invocationStartTime = [DateTime]::UtcNow
$object = Get-ChildItem -Path 'C:\AdminTools'
$invocationEndTime = [DateTime]::UtcNow
$writeToLogAnalyticsSplat = @{
ALWorkspaceID = 'e2920363-xxxx-xxxx-xxxx-740exxxx801'
invocationStartTime = $invocationStartTime
PSObject = $object
ALTableIdentifier = 'ALTools' #Your name for Azure Logs
invocationEndTime = $invocationEndTime
WorkspacePrimaryKey = 'I5ZBxxxxxxxxxxxRkiy8uZ77rfTKKvzeI+g=='
}
Write-ToLogAnalytics @writeToLogAnalyticsSplat -Verbose
