function Get-GraylogStreamId { <# .SYNOPSIS Gets the ID of a log stream in Graylog. .DESCRIPTION Gets the ID of a log stream in Graylog using the provided log name. .PARAMETER LogName The name of the log stream to get the ID for, the log name has to be an exact match for a known log stream. .OUTPUTS The ID of the log stream if it exists, otherwise null. .EXAMPLE Get-GraylogStreamId -LogName "Windows Security" Gets the ID of the log stream with the name "Windows Security" (645b6fdd9d3689589cdce1bc). #> param ( [Parameter(Mandatory)] [ValidateSet("Infoblox", "Infoblox DNS", "Windows Application", "Windows Security", "Windows System")] [string] $LogName ) # TODO: Use Secret Management module to get the Graylog API URI if ($null -eq $global:GraylogStreams) { $Response = Invoke-GraylogRequest GET "/streams" $global:GraylogStreams = $Response.Streams } $Stream = $global:GraylogStreams.Where{$_.Title -eq $LogName} if ($null -eq $Stream) { return $null } return $Stream.Id }