27 lines
796 B
PowerShell
27 lines
796 B
PowerShell
function Disconnect-GraylogService {
|
|
<#
|
|
.SYNOPSIS
|
|
Disconnects from the Graylog server.
|
|
.DESCRIPTION
|
|
Disconnects from the Graylog server by deleting the session using the current WebSession data. By default, the stored credentials are not removed.
|
|
.PARAMETER Force
|
|
An optional switch to force the removal of the stored credentials as well as the session.
|
|
.OUTPUTS
|
|
None
|
|
.EXAMPLE
|
|
Disconnect-GraylogService
|
|
Disconnects from the Graylog server.
|
|
.NOTES
|
|
Garbage collection is called after the session is deleted to ensure that the session is removed from memory.
|
|
#>
|
|
[Alias("Disconnect-Graylog")]
|
|
param (
|
|
[Parameter()]
|
|
[Switch]
|
|
$Force
|
|
)
|
|
Invoke-GraylogRequest DELETE "/api/system/sessions"
|
|
Remove-Secret Graylog_Session
|
|
if ($Force) { Remove-Secret Graylog_Credential }
|
|
}
|