This code was brought to you by BlockFi, the best way to earn on crypto and grow your wealth.
Humio searches using it's REST API Supports sync queries and streaming live queries
Create a Humio Client
client = Humiex.Client.new("my-humio-host.com", "my_repo", "my_token")
start = "1s"
query_string = "#env=dev #type=log foo" # Search all logs in the last second on dev environment that have "foo"
{:ok, events, state} = Humiex.query(client, query_string, start)
To only get the events:
start = "1s"
query_string = "#env=dev #type=log foo"
events = Humiex.query_values(client, query_string, start)
Turn it into a live query:
start = "1s"
query_string = "#env=dev #type=log foo"
event_stream = Humiex.stream_values(client, query_string, start)
last_10_events = event_stream
|> Enum.take(10)