Ruby

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

Push Event

require 'uri'
require 'net/http'
require 'json'

url = URI("https://api.loghive.app/v1/event/add")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = (url.scheme == "https")

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["ApiKey"] = "YourPersonalApiKey"
request.body = {  project= "yourprojectname",  group= "yourgroupname",  event= "your-event-name",  description= "your-description",  notify= false} .to_json

response = http.request(request)
puts response.read_body

Push Insight

require 'uri'
require 'net/http'
require 'json'

url = URI("https://api.loghive.app/v1/insight/add")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = (url.scheme == "https")

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["ApiKey"] = "YourPersonalApiKey"
request.body = {  project= "MySaas",  insight= "system1-online",  value= 1} .to_json

response = http.request(request)
puts response.read_body

Last updated