Thank you for your interest in contributing to rtbeat!
rtbeat is an Elastic Beat built on
libbeat v7.17. It runs an HTTP server that
accepts rxtx MessageBatch payloads on
POST /in, parses each message, and republishes them as Beats events to the
configured Elastic output (Elasticsearch or Logstash). It also exposes
Prometheus metrics on /metrics. Behavior is configured through rtbeat.yml.
We welcome pull requests for:
- Bug fixes — fixing issues and errors
- Tests — improving test coverage
- Documentation — clarifying usage, fixing typos, adding examples
- Stability and security improvements — performance, error handling, dependency hygiene, and supply-chain hardening
For non-trivial changes, please open an issue first to discuss the approach.
- Go 1.26 (the toolchain CI uses;
make verifywill refuse to run on a mismatched major/minor version) git,make, andcurl- Optional for end-to-end testing: a reachable Elasticsearch or Logstash instance and an rxtx source to send batches
# Clone the repository
git clone https://github.com/txn2/rtbeat.git
cd rtbeat
# Build with make (CGO_ENABLED=0, output ./rtbeat)
make build
# Or build directly
CGO_ENABLED=0 go build -o rtbeat .rtbeat builds as a static binary (CGO_ENABLED=0).
# Run against the sample configuration. By default rtbeat listens on :8081
# and accepts POST /in; metrics are served on /metrics.
./rtbeat -c rtbeat.yml -e
# Send a test batch (rxtx MessageBatch JSON) to the ingest endpoint
curl -XPOST http://localhost:8081/in -d @testdata/batch.json
# Check Prometheus metrics
curl http://localhost:8081/metricsThe -e flag logs to stderr; -c selects the config file. See
rtbeat.reference.yml for the full set of configurable options.
Run make verify before opening or updating a pull request. It runs the same
checks the CI pipeline does, so you find problems locally instead of in a red
PR:
make verifymake verify performs, in order:
- check-go-version — confirms your local Go matches the required 1.26.x
- tidy-check — fails if
go.mod/go.sumare not tidy - lint —
golangci-lint(auto-installed at the CI-pinned version into.tools/) - test —
go test -race -coverprofile=... -covermode=atomic ./... - validate-actions — confirms GitHub Action references are pinned to SHAs
Individual targets are available too: make lint, make test, make build,
make tidy, make tidy-check, make validate-actions. Run make help for the
full list.
# Full suite under the race detector with coverage (matches CI)
make test
# Or run go test directly
go test ./...
go test -v ./...
go test -race ./...
# View a coverage report
go test -coverprofile=coverage.txt ./...
go tool cover -html=coverage.txtPrefer table-driven tests, and add tests alongside bug fixes and new behavior.
rtbeat depends on github.com/elastic/beats/v7@v7.17.29. This pin is
deliberate and the surrounding module configuration is fragile. Please do not
bump these casually.
- Mirrored
replacedirectives. Go does not apply a dependency'sreplacedirectives transitively, sogo.modmirrors thereplaceblock fromelastic/beatsv7.17.29 (e.g.Microsoft/go-winio,Shopify/sarama,dop251/goja,fsnotify/fsnotify,google/gopacket). These exist so the build resolves the same forks libbeat itself uses. Removing or changing them will break compilation. If you upgrade libbeat, re-derive this block from the matchingelastic/beatsgo.mod. - Pinned commit-level dependencies.
github.com/coreos/bboltandgithub.com/satori/go.uuidare pinned to specific commits/pseudo-versions required by the libbeat tree. Do not letgo mod tidyor an IDE "upgrade" silently move these —make verifywill fail thetidy-checkif they drift. - Upgrading libbeat is a focused change. Bumping
elastic/beats/v7should be its own PR. Update the version, re-sync thereplaceblock and pinned commits to match upstream, runmake verify, and confirm rtbeat still starts and publishes events end-to-end.
When you intentionally add or update a dependency, run make tidy and commit
the resulting go.mod / go.sum changes.
- Follow standard Go formatting (
gofmt/go fmt ./...) - Run
go vet ./...andgolangci-lint run(viamake lint) and resolve findings before pushing - Add doc comments for exported functions and types
- Handle errors explicitly; do not discard them silently
- Use
go.uber.org/zapfor structured logging, consistent with the existing code - Keep the HTTP handlers (
/in,/metrics) and the Beats publishing path decoupled and well tested - Follow existing patterns in the codebase rather than introducing new ones
- Fork the repository and create a branch:
git checkout -b fix/short-description - Make your changes and add tests for new or fixed behavior
- Run
make verifyand ensure it passes - Commit with clear, descriptive messages
- Open a pull request against
master
Use clear, descriptive commit messages that explain the what and the why:
Fix: reject malformed rxtx batches with 400 instead of panicking
- Validate MessageBatch before publishing
- Return a JSON error body for bad input
- Add a test covering a truncated payload
Sign off your commits to certify the Developer Certificate of Origin:
git commit -s -m "Fix: reject malformed rxtx batches with 400"The -s flag adds a Signed-off-by trailer with your name and email.
- Title — a clear description of the change
- Description — explain what and why, not just what
- Tests — include tests for bug fixes and new behavior
- Documentation — update
README.md,rtbeat.reference.yml, or other docs if behavior or configuration changes - Size — keep PRs focused; split large changes
- Checks — confirm
make verifypasses locally
Include:
- rtbeat version (
rtbeat version) - The relevant portion of your
rtbeat.yml(redact secrets) - The Elastic output in use (Elasticsearch or Logstash) and its version
- A sample rxtx batch or request that triggers the problem, if applicable
- Operating system and version
- Steps to reproduce, and expected vs. actual behavior
- Relevant log output
For security vulnerabilities, please follow SECURITY.md instead of opening a public issue.
Please review our Code of Conduct before contributing.
Open a GitHub issue for questions or discussion.
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.