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):- macOS / Linux
- Windows
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
- Install the Infinity plugin:
grafana-cli plugins install yesoreyeram-infinity-datasource, or via Grafana’s in-app plugin catalog. - Register the datasource: apply
datasource.yamlvia Grafana’s provisioning mechanism, or add it manually through the UI. - Run the export script (leave it running), or the two commands from
How it works above on Windows without WSL/Git Bash:
- Import
dashboard.jsonthrough Dashboards → Import, selecting your Infinity datasource when prompted.
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 inwatch -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.
