Help with using Audit Logs

Hi all,
I need to trigger a pipeline in GOCD whenever changes are made for a specific project in Octopus. I can see the events(changes) that are made from Audit logs. Do you have an idea how can I use them in Powershell script? Thank you!

Hi @pro.semi,

Thanks for getting in touch!

The easiest way to interact with the server in Powershell is by using the octopus.client.
We have a repository of sample scripts here:

One that may be useful as a starting point for you would be this script that returns all events between a specific date range:

# You can this dll from your Octopus Server/Tentacle installation directory or from
Add-Type -Path 'C:\Program Files\Octopus Deploy\Octopus\Octopus.Client.dll' 

$apikey = 'API-CMPCNOYGUU62FBUJF4GV9IVYG' # Get this from your profile
$octopusURI = 'http://localhost:80' # Your server address

$endpoint = new-object Octopus.Client.OctopusServerEndpoint $octopusURI,$apikey 
$repository = new-object Octopus.Client.OctopusRepository $endpoint

[System.DateTimeOffset]$after = "1/1/2020"
[System.DateTimeOffset]$before = "1/28/2020"

#Using lambda expression to filter events using the FindMany method
    {param($e) if(($e.Occurred -gt $after) -and ($e.Occurred -lt $before)){

I hope this helps, please let me know if you have any further questions.

Best regards,

Hi Paul,
Thank you for the help. I will try to implement this and then I will inform you.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.