Skip to main content
ObsidianLog has no persistent query HTTP API. Querying happens via obsidianlog query, run on demand. To visualize results in Grafana, the example in this repo bridges the two with the free Infinity datasource plugin, which reads JSON from a URL.
This is an example, not a built-in feature. A dedicated Grafana datasource plugin is a possible future direction, not something ObsidianLog includes today.

How it works

Infinity reads from a URL, not a local file or a command, so a small script exports a query to JSON and serves it over HTTP. This needs Python installed (Windows doesn’t bundle it the way macOS and most Linux distributions do, get it from python.org if you don’t have it):
logs.json contains decrypted log data. The example binds the temporary server to localhost deliberately. Do not expose it publicly. If Grafana runs on another host, put an authenticated, TLS-protected proxy in front of a purpose-built export path instead of opening this temporary server to the network.
The full, runnable version, with argument handling and the run instructions, is examples/integrations/grafana/export-and-serve.sh in the repo. It’s a bash script (macOS/Linux, or WSL/Git Bash on Windows). On Windows without one of those, run the two commands above directly instead, adjusting the port or adding --config <path> to the query command as needed.

Setting it up

  1. Install the Infinity plugin: grafana-cli plugins install yesoreyeram-infinity-datasource, or via Grafana’s in-app plugin catalog.
  2. Register the datasource: apply datasource.yaml via Grafana’s provisioning mechanism, or add it manually through the UI.
  3. Run the export script (leave it running), or the two commands from How it works above on Windows without WSL/Git Bash:
  4. Import dashboard.json through Dashboards → Import, selecting your Infinity datasource when prompted.
You’ll see a table of archived logs: timestamp, service, level, host, and message (pulled from the original event’s msg/message field, nested under raw in the query output). See obsidianlog query for the full field shape.

Keeping it fresh

The export script is one-shot: it snapshots the current query results once. For continuous refresh, wrap it in watch -n 60 ./export-and-serve.sh, a cron job, or a systemd timer. These are deliberately not included, to keep this an example rather than infrastructure to maintain.