Skip to content

mczerniawski/ALTools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Build Status Branch
Build status master
Build status dev

Index

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

About

Tools required to send logs to Azure Logs

Resources

License

Stars

Watchers

Forks

Packages

No packages published