log2http

command module
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2023 License: GPL-3.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

log2http

Matches log lines to trigger HTTP requests. A super hacky alternative to ELK or loki.

Supported HTTP Targets

  • Discord

Caveats

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

Usage

Docker

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"
Binary

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$

Development

The development environment is currently set up with nix flakes.

Development Environment
$ nix develop
Build Binary
$ nix build
Build and Run Binary
$ nix run .#log2http -- -file filename

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址