|
||
---|---|---|
build_logs | ||
dist | ||
.gitignore | ||
README.md | ||
build-run-test.sh | ||
build.sh | ||
go.mod | ||
go.sum | ||
install.sh | ||
log.log | ||
main.go | ||
test.sh | ||
version.go |
README.md
You can stream and read files to a BugSink DSN, GlitchTip, or Sentry. I was fed up with how brittle sentry-cli was so I made this.
I might get around to making a whole CI/CD process for this which will upload the executables properly at some point and make this public.
Go Sink
Go Sink is a command-line utility that reads log messages from a file or stdin and sends them to BugSink, GlitchTip, or any compatible error tracking system.
Installation
To install the binary locally, you can use the provided installation script. Run the following command in your terminal:
# For the latest stable version
curl -sSL https://git.nixc.us/Nixius/go-sink/raw/tag/v0.0.1/install.sh | bash
# Or to install a specific version (replace v0.0.1 with your desired version)
curl -sSL https://git.nixc.us/Nixius/go-sink/raw/tag/v0.0.1/install.sh | bash
This will download and install the Go Sink binary to your local machine.
Usage
You can use Go Sink by specifying a log file as an argument or by piping input to it.
Using a Log File
go-sink /path/to/logfile
Using Piped Input
cat /path/to/logfile | go-sink
Server Mode
You can also run Go Sink in server mode, which starts a webhook server that accepts log messages via HTTP requests:
go-sink server
The server listens on port 5050 by default. You can send log messages to the webhook endpoint:
curl -X POST -H "Content-Type: application/json" \
-d '{"log_level": "error", "message": "Error message", "service": "my-service"}' \
http://localhost:5050/webhook
Configuration
Go Sink supports multiple environment variables for the DSN. You can use any of the following:
BUGSINK_DSN
: For BugSink instancesGLITCHTIP_DSN
: For GlitchTip instancesSENTRY_DSN
: For Sentry instances
If multiple environment variables are set, they are checked in the order listed above, and the first one found is used.
Setting the DSN
Shell Environment
Add one of the following lines to your .zshrc
or .bashrc
file:
export BUGSINK_DSN="your-dsn"
# OR
export GLITCHTIP_DSN="your-dsn"
# OR
export SENTRY_DSN="your-dsn"
After adding the line, reload your shell configuration:
source ~/.zshrc # for zsh users
source ~/.bashrc # for bash users
Dockerfile
If you are using a Docker container, add the environment variable in your Dockerfile
:
ENV BUGSINK_DSN=your-dsn
# OR
ENV GLITCHTIP_DSN=your-dsn
# OR
ENV SENTRY_DSN=your-dsn
docker-compose.yml
If you are using Docker Compose, add the environment variable in your docker-compose.yml
file:
services:
go-sink:
image: your-docker-image
environment:
- BUGSINK_DSN=your-dsn
# OR
# - GLITCHTIP_DSN=your-dsn
# OR
# - SENTRY_DSN=your-dsn
Development
Testing Protocol
Go Sink includes a comprehensive test suite in build-run-test.sh
that ensures all functionality works correctly:
-
Build and Verification: The script builds the application for all supported platforms and verifies that the binaries are created.
-
Environment Variable Tests: Each supported DSN environment variable is tested with both plain text and JSON input:
BUGSINK_DSN
GLITCHTIP_DSN
SENTRY_DSN
-
Priority Tests: The script tests that when multiple environment variables are set, the correct order of precedence is followed.
-
Webhook Tests: The server mode is tested with both single and batch webhook requests.
To run the tests, simply execute:
./build-run-test.sh
The script provides clear, color-coded output with pass/fail indicators for each test.
Contributing
Before submitting changes, please ensure that:
- You have run
./build-run-test.sh
to verify that all tests pass - Your changes maintain compatibility with all supported DSN environment variables
- Any new features include appropriate tests in the test suite