Matches log lines to trigger HTTP requests. A super hacky alternative to ELK or loki.
- Discord
At the moment, the following edge cases apply:
- There is no knowledge of what lines trigger requests, so requests could be duplicated upon restart
- There is no retry mechanism, so failed webhooks will not be retried
A docker image is available at ghcr.io/danielunderwood/log2http. Really you probably want to use docker-compose or some other system to manage configuration (ansible, k8s manifests, etc), but this should get you started.
$ docker run -d \
-v $LOG_DIR:/logs \
-e URL=https://example.com/... \
--name log2http \
ghcr.io/danielunderwood/log2http -file /log/whatever.log -sourceName "$(hostname)/docker" -regexp "a|b"
Binaries for most major OS (Linux/MacOS/Windows/BSD) and architecture (x64/arm/arm64) are available under releases.
$ log2http -file FILENAME -regexp "^[Rr]egex$" -url https://discordapp.com/...
$ # Or supply URL via environment
$ export URL="https://discordapp.com/..."
$ log2http -file FILENAME -regexp "^[Rr]egex$
The development environment is currently set up with nix flakes.
$ nix develop
$ nix build
$ nix run .#log2http -- -file filename