PowerShell

LogHive provides a simple REST API that you can use to push events and errors. Here is an example code for PowerShell:

Push Event

$url = 'https://api.loghive.app/v1/event/add'
$headers = @{
  'Content-Type' = 'application/json'
  'ApiKey' = 'YourPersonalApiKey'
}
$data = @{
  project= 'yourprojectname'
  group= 'yourgroupname'
  event= 'your-event-name'
  description= 'your-description'
  notify= false
} | ConvertTo-Json
    
    
Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body $data

Push Insight

$url = 'https://api.loghive.app/v1/insight/add'
$headers = @{
  'Content-Type' = 'application/json'
  'ApiKey' = 'YourPersonalApiKey'
}
$data = @{
  project= 'MySaas'
  insight= 'system1-online'
  value= 1
} | ConvertTo-Json
    
    
Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body $data

Last updated