Humio searches using it's REST API Supports sync queries and streaming live queries
Add to your dependencies
deps = [
...
{:humiex, "~> 0.1.0"},
...
]
Create a Humio Client
client = Humiex.new_client("https://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)
This code was brought to you by BlockFi, the best way to earn on crypto and grow your wealth.