Data
Get every firewall decision out of the container and into your SIEM.
Every package download the firewall checks produces a decision event: allowed, warned, monitored, or blocked. You can ship those events three ways.
| Output | Configure | Use when | Page |
|---|---|---|---|
| Splunk HEC | Container env vars | You use Splunk | Splunk config |
| Webhook | Container env vars | Anything else: Sentinel, Elastic, a ticketing workflow | Webhook config |
| Container logs | One .env line | You already ship container stdout | Below |
Two different webhooksThese pages cover the firewall's webhook, set by environment variables on the container. The webhook under Dashboard → Settings → Webhooks is separate and does not carry install decisions.
What an event contains
Each event is JSON and carries the fields in the table below.
| Field | Meaning |
|---|---|
timestamp | Epoch seconds, with a fraction (for example 1793310476.523) |
client_ip | Who requested the package |
registryFqdn | The firewall hostname the request arrived on, not the upstream registry |
repo | Which route served it |
purl / artifact_purl | purl names the package and artifact_purl names the exact file that was checked. For npm both include the version. For PyPI, purl is the package name plus ?artifact_filename=... with no version, and artifact_purl adds the version |
action, decision | What the firewall did |
block_reason / warn_reason / monitor_reason | Why, for blocks, warnings and monitored downloads |
blocked_alerts | The alerts that caused a block |
request_id | Matches the ID a developer sees in a blocked install |
cached | Whether the verdict came from the firewall's cache |
Container logs (one setting)
Decisions are written to stdout as [SOCKET_DECISION] lines followed by JSON, but each kind is logged at its own level, and clean allows are hidden by default:
| Decision | Default log level | Shown by default |
|---|---|---|
| Block | error | Yes |
| Allowed with a warn alert | warn | Yes |
| Allowed with a monitor alert | notice | Yes |
| Clean allow (ignore) | debug | No |
To log every decision, add this to .env and recreate the container. Stand up Socket Firewall for the first time already includes it.
SOCKET_IGNORE_LOG_LEVEL=warndocker compose up -d --force-recreate
docker compose logs socket-firewall | grep SOCKET_DECISION
Reassemble split eventsAn event longer than
socket.log_max_body_sizeis split across several lines tagged[SOCKET_DECISION 1/2],[SOCKET_DECISION 2/2]. Reassemble the lines before parsing;jqfails on the fragments. Filter on the prefix[SOCKET_DECISION, not on log level.
Things that apply to every output
- Events fire on downloads only, unless metadata filtering is on. Without metadata filtering, requests for package metadata produce no events. With metadata filtering, each listing logs one event per version checked, up to
max_versions. These events carryblock_source: "metadata". Leave them out when counting blocked installs. For PyPI, pip downloads the.whl.metadatafile and then the wheel, so one package logs two events with the samepurland differentsource_path. To count PyPI installs once, dedupe onpurlplusclient_ip. - Count on
decision, notaction.decisionis what the client actually got. - Client-side caches skip the firewall. A package already in a developer's npm cache or a warm
.m2directory never reaches the firewall, so there's no event. - Behind a load balancer,
client_ipis the balancer's address until you setclient_ip.headerandclient_ip.trusted_proxiesinsocket.yml. See Client IP Detection.
Updated 3 days ago