Repository navigation
Releases
v0.3.1
The program is unchanged. This release is for the files that come with it: the example rule file the install downloads is much shorter, and there is a seventh rule template.
Added
- A seventh rule template,
examples/06-private-data.yaml, for private files and customer data: guessing the names of uploaded files (ID scans, contracts, spreadsheets), bulk downloads of documents, walking through record numbers, one address opening member records or orders in the admin area in bulk, and every export from the admin area. - The README shows how to have a coding agent (Claude Code, OpenAI Codex) write the rules from your project's code, with a prompt to start from.
Changed
rules.example.yamland the templates underexamples/carry far fewer comments, so they are easier to edit. What the comments explained is indocs/rules.md, which each file links to; what to change in each template is in a table under "Using the rule templates".
v0.3.0
Restarting httpdog no longer loses log lines, and sudo httpdog -t checks the rule file the way nginx -t checks nginx's configuration. The first of these changes how httpdog is installed under systemd: there are now two unit files, and an existing install has to be upgraded by hand, see "Two unit files in place of one" below.
Added
httpdog -tchecks the rule file the waynginx -tchecks nginx's configuration.-tis--checkunder a shorter name, with two things that makesudo httpdog -tenough on an installed host. Without--configit checks/etc/httpdog/rules.yaml. And a variable the rule file refers to that is not in the environment is looked up in/etc/httpdog/secrets.env, read the way systemd reads it, so the check no longer ends inenvironment variable ... is not setfor lack of the webhook URL and secret. The answer names the file:OK: /etc/httpdog/rules.yaml: 4 rule(s).
Fixed
- A restart of httpdog lost one log line for every nginx worker, and every line sent while it was down. httpdog created its socket itself, so each restart made a new one: nginx's workers were still connected to the old one, and each found out by losing its next line. Unless nginx was reloaded right after, a probe that happened to be a worker's first request after the restart raised no alert. Now systemd creates the socket and holds it (
deploy/httpdog.socket), and passes it to httpdog at every start. A restart keeps the same socket, nginx needs no reload, and the lines sent in the meantime wait in the socket until httpdog is back: a few hundred fit, 512 at most. This coverssystemctl restart, a crash, the watchdog and the memory ceiling.
Changed
-
Two unit files in place of one.
deploy/httpdog.socketis new and describes the socket: its path, its mode (0660) and its group.deploy/httpdog.serviceno longer creates the directory or hands the socket to the web server's group, and needshttpdog.socket. Who can send logs is unchanged, root and the web server's group, and httpdog is still not a member of that group; it now cannot remove or replace the socket file either, which belongs to root. To upgrade an install of 0.2.x:sudo systemctl stop httpdog # While the old unit file is still loaded: it removes the old socket # Install the new binary (step 1 of the README), fetch the two unit files (step 2), then: sudo install -m 644 httpdog.service httpdog.socket /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable --now httpdog # Enables and starts httpdog.socket too sudo systemctl reload nginx # One last time
The new binary also runs under the old unit file, behaving as before. The new unit files need the new binary: an older one fails with
a socket is already there and cannot be checked. -
The group is set in
httpdog.socket. If you changedwww-datainhttpdog.service(tonginxon Fedora or Rocky Linux), make the same change toSocketGroup=inhttpdog.socket. -
With a
listenother than the default, the address goes inhttpdog.socketas well. httpdog checks that the socket systemd passed is the onelistennames and does not start when they differ (exit status 78), because it would otherwise run and receive nothing. For UDP, writeListenDatagram=127.0.0.1:5514inhttpdog.socket. With the default socket there is nothing to do. For the same reason a reload refuses a rule file whoselistendiffers from the socket systemd holds, and keeps the old rules: taking it would leave a rule file that works until the next restart or reboot and then keeps httpdog down. -
Stopping httpdog alone does not keep it stopped. The socket stays with systemd, and the next log line starts httpdog again. Use
sudo systemctl stop httpdog.socket httpdog. -
After a rule file error at startup (exit status 78), systemd tries a few more times when a log line arrives and then stops
httpdog.sockettoo. Fix the file, thensudo systemctl start httpdog && sudo systemctl reload nginx. -
httpdog started without systemd, or without
httpdog.socket, creates its socket itself as before. -
--checkwithout--confignow checks/etc/httpdog/rules.yaml, where it used to check./rules.yaml, and its answer starts with the name of the file. Running httpdog without--configstill uses./rules.yaml. -
A new dependency,
sd-listen-fds(142 lines, no dependencies of its own), takes the socket systemd passes. That step needsunsafein Rust, which httpdog's own code still forbids. -
Every release also carries its build provenance as
httpdog.intoto.jsonl, the same content ashttpdog.sigstore.jsonunder the name OpenSSF Scorecard looks for. The file was added to the five releases already published; their binaries and other files are unchanged.
Documentation
- The README starts with the install, and the install is one path from the download to a first alert: it now includes connecting nginx (the snippet goes into
/etc/nginx/conf.d/), a placeholder for whoever has no receiver yet, and reading httpdog's log. The "Try it first" section is gone; replaying the sample log to test a receiver is indocs/webhook.md. - New in the README and
docs/log-format.md: aserver { }block with anaccess_logline of its own does not use the one for httpdog, and needs the line as well. - The README and
docs/webhook.mdpoint to httpdog-house, a separate project that receives httpdog's webhook alerts, verifies them, and keeps them searchable on web pages, on your own Cloudflare account. The README shows a screenshot of its alerts page, in the reader's light or dark theme.
v0.2.3
The program behaves the same as 0.2.2. The changes are in the systemd unit file, the documentation, and a guarantee about the code.
Added
#![forbid(unsafe_code)]in the library and the binary: the compiler now refusesunsafecode in httpdog itself. There was none; this keeps it that way.
Documentation
- The README says what httpdog being written in Rust buys: speed, with the measured rate (250,000 to 500,000 lines a second on a laptop, depending on the rules), and memory safety for a program that reads text chosen by attackers.
docs/limits.mdhas the measurement.
Changed
deploy/httpdog.serviceputs a ceiling of 256 MB on httpdog's memory (MemoryMax=256M,MemorySwapMax=0). httpdog normally uses a few megabytes, but the counters of a rule withgroup_bygrow with the number of distinct groups, and nothing limited that. At the ceiling the kernel kills httpdog and systemd restarts it with empty counters. To get it, install the new unit file and runsudo systemctl daemon-reload && sudo systemctl restart httpdog.
v0.2.2
Fixed
- Memory was not given back after a burst of distinct groups. A rule with
group_bykeeps a counter for every group it is counting. The counters were removed once they expired, but the table that held them stayed at its largest size until the next restart: 500,000 groups left about 80 MB behind. The table now shrinks when it empties.
v0.2.1
Fixes two problems found by installing 0.2.0 on servers at a cloud provider. Each could leave a site without alerts it should have had.
Fixed
- The example rules missed probes on sites with a custom error page or a front controller. They matched paths with
uri, which nginx replaces: witherror_page 404 /404.html;(the default configuration of Rocky Linux 9 has it) a request for/.envthat ends in a 404 is logged withuriset to/404.html, and withtry_files ... /index.phpevery request hasuriset to/index.php.rules.example.yamland the templates underexamples/now match paths with the newrequest_path.sensitive-file-exposedstill matchesurion purpose: it is about the file nginx actually served. Rules of your own that matchuribehave as before; switch them torequest_pathif your site has either of the two. - With SELinux enforcing, nginx could not send its log to the unix socket, so no alert was ever raised. This is the default state of Fedora, RHEL and Rocky Linux. The new
deploy/httpdog-selinux.cilholds the one rule that allows it; install it withsudo semodule -i httpdog-selinux.cil.
Added
request_path: the path the client asked for, which isrequest_uriwithout the query string. With the JSON format httpdog adds it to every log line that hasrequest_uri, so nginx'slog_formatneeds no change; thecombinedformat has it too, with the same value asuri. The webhook body carries it inevent.
Documentation
docs/log-format.mdexplains the three path fields (request_path,request_uri,uri) and when to use which.docs/limits.mdlists the six cloud servers 0.2.0 was installed on, including two with SELinux enforcing.
v0.2.0
Changed (incompatible)
- Logs now arrive on a unix socket by default:
listendefaults tounix:/run/httpdog/httpdog.sockinstead of the UDP address127.0.0.1:5514. httpdog believes every line it receives, and on UDP any program that could reach the address could send lines and raise false alerts. The socket is open to root and the web server's group only. To upgrade from 0.1.0: install the newdeploy/httpdog.service, change nginx'ssyslog:server=tounix:/run/httpdog/httpdog.sock, restart httpdog and reload nginx. A rule file that setslisten: 127.0.0.1:5514itself, as therules.example.yamlof 0.1.0 did, keeps receiving over UDP and now prints the warning below. - A malformed
listenis now a rule file error (exit status 78) instead of a failure to listen (exit status 1).
Added
listen: unix:/pathreceives logs on a unix datagram socket, created with mode0660.deploy/httpdog.servicehands it to the group nginx's workers run as; httpdog does not join that group.- A warning in the log at every start when
listenis a UDP address, with stronger wording when the address is not a loopback address. - A reload that finds a changed
listensays that it only takes effect after a restart.
Known limitations
- Restarting httpdog without reloading nginx loses one log line per nginx worker, see
docs/limits.md.
v0.1.0
First release.
Features
- Reads nginx / Apache access logs, matches them against a rule file and sends alerts. Input arrives over syslog UDP, or through
--stdinfor pipes and for replaying old logs. - Supports the
jsonlog format (with nginx'slog_format ... escape=json) andcombined(the default format of nginx / Apache, so the web server's log settings stay untouched; Apache'scommonworks too). - Rules are written in YAML or JSON. Conditions nest freely with
all/any/not, with 12 operators (eq,ne,in,prefix,suffix,contains,regex,gt,gte,lt,lte,exists). - Thresholds (
threshold: fire only after M hits within N seconds), grouping (group_by: for example each IP counted separately) and cooldowns (cooldown: notify at most once per group within a period). - Notifies stderr or a webhook. A webhook POSTs JSON to your own receiver, with a separate field for each part of the alert. A failure is retried, for 3 attempts in total.
- Webhook signatures: every webhook must have a secret, and every request carries
X-Httpdog-TimestampandX-Httpdog-Signature(HMAC-SHA256), so the receiver can verify that the request really came from httpdog, that the body was not altered, and reject expired requests. instanceat the top of the rule file: the name of this httpdog instance (e.g.web-01). The webhook body carries it, which tells the sources apart when several send to the same receiver.- Log content is treated as hostile: the one-line text of an alert never contains a control character, so a request cannot forge a line in the system log. The log parsers and the rule engine are fuzzed.
- Release binaries come with a signed build provenance attestation (
gh attestation verify). overload: when logs are dropped because traffic exceeds the processing rate, an alert can be sent in addition to the log line.- The rule file is validated completely at load time, and a mistake is reported with its location.
--checkvalidates without starting. - Built for systemd:
Type=notify, watchdog, reload onSIGHUP(a broken new rule file keeps the old rules), and exit status 78 on a rule file error so it is not restarted forever. - Ships 6 example rule files (
examples/): a starter for thecombinedformat, plus 5 scenarios: security probing, login abuse, site health, traffic anomalies and business-critical paths. - Replaying
sample.logwithrules.example.yamlsends 3 alerts, so it can be used to test your own receiver.
Known limitations
- Thresholds use the time a log is received, not the time written in the log.
- Counters and cooldowns are in memory only and reset on restart or reload.
- There is no built-in file-reading mode; reading a log file needs
tail -Fpiped into--stdin. - Verified under systemd with real nginx and Apache on Ubuntu 22.04 to 26.04, Debian 11 to 13, Fedora 44 and Rocky Linux 10, but not yet under production traffic. See
docs/limits.mdfor the full list and the verification status.