Skip to content

Repository files navigation

Humiex

Humio searches using it's REST API Supports sync queries and streaming live queries

Installation

Add to your dependencies

deps = [
  ...
  {:humiex, "~> 0.1.0"},
  ...
]

Usage

Create a Humio Client

client = Humiex.new_client("https://my-humio-host.com", "my_repo", "my_token")

Query

  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)

Stream

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages