Build and release tooling:
- Makefile with help as default; targets: build/build-amd64/build-arm64,
test, lint, proto, pkg-deb, docker, docker-push, clean, plus
install-deps (+ three sub-targets for apt / Go toolchain / Go tools).
- internal/version package; -ldflags -X injects Version/Commit/Date into
every binary. -version flag on all four binaries (nginx-logtail version
for the CLI).
- Dockerfile takes VERSION/COMMIT/DATE build-args and forwards them.
- .deb output lands in build/; .gitignore ignores /build/.
Debian package:
- debian/build-deb.sh packages all four static binaries into a single
nginx-logtail_<ver>_<arch>.deb using dpkg-deb.
- Binary layout: /usr/sbin/nginx-logtail-{collector,aggregator,frontend}
and /usr/bin/nginx-logtail.
- nginx-logtail(8) manpage.
- Three systemd units (collector, aggregator, frontend) shipped under
/lib/systemd/system/. Installed but never enabled or started — the
operator opts in per host.
- Collector runs as _logtail:www-data (log access); aggregator and
frontend as _logtail:_logtail. postinst creates the system user/group
idempotently.
- Single shared env file /etc/default/nginx-logtail rendered from a
template at first install with %HOSTNAME% substituted. Sensible
defaults for every COLLECTOR_*, AGGREGATOR_*, FRONTEND_* variable;
plus COLLECTOR_ARGS / AGGREGATOR_ARGS / FRONTEND_ARGS escape hatches
appended to ExecStart. Not a dpkg conffile: operator edits survive
upgrades and dpkg --purge removes it.
Versioned UDP wire format:
- ParseUDPLine dispatches on a leading "v<N>\t" tag; v1 routes to the
existing 12-field parser. Unknown/missing versions fail closed so
future v2 parsers can land before emitters are upgraded.
- Tests updated; design.md FR-2.2 rewritten to make the version tag
normative.
Docs:
- README.md gains a Quick Start (Debian / Docker Compose / from source).
- user-guide.md rewritten around Installation and Configuration: full
env-var table, UDP-only default explained, precise file/UDP log_format
layouts, note that operators can emit "0" for unknown \$is_tor / \$asn.
- Drilldown cycle, frontend filter table, and CLI --group-by list all
include source_tag. UDP counters documented in the Prometheus section.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
51 lines
1.7 KiB
Bash
Executable File
51 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# Runs after the package is unpacked. We:
|
|
# 1. create the system user/group _logtail (idempotent);
|
|
# 2. on first install, render /etc/default/nginx-logtail from the template;
|
|
# 3. reload systemd.
|
|
#
|
|
# We deliberately do NOT enable or start the units — some hosts run only the
|
|
# collector, some only the aggregator, some run both with the frontend, some
|
|
# run neither. The operator is expected to run:
|
|
#
|
|
# systemctl enable --now nginx-logtail-collector.service
|
|
# systemctl enable --now nginx-logtail-aggregator.service
|
|
# systemctl enable --now nginx-logtail-frontend.service
|
|
#
|
|
# on the hosts that should run each service.
|
|
set -e
|
|
|
|
TEMPLATE=/usr/share/nginx-logtail/default.template
|
|
TARGET=/etc/default/nginx-logtail
|
|
|
|
if [ "$1" = configure ]; then
|
|
if ! getent group _logtail >/dev/null; then
|
|
addgroup --system _logtail
|
|
fi
|
|
if ! getent passwd _logtail >/dev/null; then
|
|
adduser --system --ingroup _logtail \
|
|
--no-create-home --home /nonexistent \
|
|
--shell /usr/sbin/nologin \
|
|
--gecos "nginx-logtail" \
|
|
_logtail
|
|
fi
|
|
|
|
# First install: $2 is empty. Render the template with the current
|
|
# short hostname, but never clobber an existing file (in case the
|
|
# operator dropped one in manually before installing).
|
|
if [ -z "$2" ] && [ ! -e "$TARGET" ]; then
|
|
HOSTNAME_SHORT="$(hostname -s 2>/dev/null || hostname 2>/dev/null || echo localhost)"
|
|
# Use a delimiter unlikely to appear in hostnames.
|
|
sed "s|%HOSTNAME%|${HOSTNAME_SHORT}|g" "$TEMPLATE" > "$TARGET"
|
|
chmod 0644 "$TARGET"
|
|
chown root:root "$TARGET"
|
|
fi
|
|
|
|
if [ -d /run/systemd/system ]; then
|
|
systemctl daemon-reload || true
|
|
fi
|
|
fi
|
|
|
|
#DEBHELPER#
|
|
exit 0
|