grippo
Parse, match and scrub data at scale.
grippo is a Rust library for parsing, matching and scrubbing log records. It tells you how each rule will run before you run it.
Primitives, and what they cost
grippo is built from typed primitives, one per sub-pattern: a literal, an IPv4 address, a timestamp, a run of non-space. Each is written for that one shape, so it doesn't carry a general engine's machinery.
Compose them. compose joins primitives into a parser with no pattern text:
use ;
let parser = literal
.then
.then
.then
.then
.build?;
That's the route to take for a new format. A composed parser runs on the same steps as the grok pattern it mirrors, gives the same fields, and costs no more. docs/compose.md has the parts.
Porting? Regex and grok patterns lower onto the same primitives where they can, and grok! compiles a fixed pattern into calls to them when your crate builds. On the stock grok patterns that's faster than PCRE2-JIT, figures below. A pattern that can't be lowered runs on the regex engine with the same answer, and tier() and Grok::explain() say which path it took and why.
Every matcher and parser reports a worst-case tier: Fixed, Byte, Literal, LiteralSet, Field, Regex or Backtracking, in that order of cost class. Most also report a cost in ns, measured on our bench host. A build can reject any pattern below the tier you set, so a slow rule fails when it loads.
Parsers nest by default
A chain is written as syslog > cef. The syslog parser hands its message to the CEF parser without copying it, and both write fields to your sink. A value is copied only when it has to be unescaped.
The same goes for a container log line holding JSON, or a JSON field holding key=value.
Why this way
Speed, and CPU efficiency mostly. Our internal tests are as follows, and your mileage will vary with data shape. These are compiled stock grok patterns on our bench host (28 Nov 2026), against a DFA in front of PCRE2-JIT:
| Line | grippo | DFA + PCRE2-JIT | PCRE2-JIT alone |
|---|---|---|---|
| access log, hit | 326 ns | 621 ns | 253 ns |
| syslog, hit | 166 ns | 554 ns | 148 ns |
| access log, late miss | 118 ns | 178 ns | 3,758 ns |
PCRE2-JIT alone is quicker on a hit, but it pays heavily on a line that fails late, which is why it gets a DFA in front. docs/performance.md has the method, the misses and the firewall line.
The tiers are the other reason. You can compare rules by their worst case before they ship. Measure on your own data before you plan capacity on the ns figures.
No async runtime, no network, no TLS. The default features build for wasm32-wasip2.
What it gives you
strmatchruns a regex-shaped pattern on the cheapest engine that gives the same answer: a byte scan, a literal search or a literal set. A build can reject a pattern that falls to the regex engine.fieldscans the usual sub-patterns, such asIPV4,NUMBERandTIMESTAMP_ISO8601, each exact to the regex it stands for.groklowers a grok pattern onto those scanners.grok!compiles a fixed pattern to Rust when your crate builds.formathas stock parsers for syslog, CEF, LEEF, NDJSON, GELF, XML, CSV, key=value, dissect, CRI and web access logs.parseis oneParsertrait and a driver that runs a chain of them, written as it is said:syslog > cef. A parser hands its body or a value to the next with no copy, and fields go to a sink you write.scrubmasks or hashes secrets, credential fields and personal data, and reports by rule without ever holding a value.xmlturns XML documents into JSON records as the bytes arrive.MatcherTierandcostgive every matcher and parser a worst-case class and a price in ns.
Example
This parses a syslog line whose message is CEF.
use register_stock;
use ;
Build the plan once per source. A value is a span of the input line unless its parser had to unescape it.
The parsers you name are the ones that run. Detection is opt-in, a hop at a time:
| Chain | What runs |
|---|---|
syslog > auto |
syslog, then the parser the message's content names |
auto* |
Detect the record, then every body and value below it |
ndjson > field("event"):cef |
JSON, then the value it wrote as event, as CEF |
Documentation
Each box names the feature that gates its module. format sits behind parse, and each stock format behind a parse-* feature of its own.
---
config:
theme: base
look: neo
fontFamily: Inter, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif
flowchart:
curve: linear
nodeSpacing: 40
rankSpacing: 64
padding: 18
wrappingWidth: 280
htmlLabels: true
elk:
preset: modelOrder
themeVariables:
fontSize: 15px
lineColor: "#64748B"
primaryTextColor: "#0F172A"
nodeBorder: "#334155"
clusterBorder: "#0072B2"
edgeLabelBackground: "#FFFFFF"
themeCSS: >-
p{margin:0}
.node[data-look] rect,.node[data-look] path,.node[data-look] polygon,.node[data-look] .outer-path{filter:drop-shadow(0 1px 2px rgba(15,23,42,.10)) drop-shadow(0 6px 14px rgba(15,23,42,.10))}
.node rect{rx:10px;ry:10px}
.cluster rect{rx:16px;ry:16px}
.node .label div{min-width:150px}
.node.decision .label div{min-width:0}
.cluster[data-look] rect{filter:none}
.nodeLabel{line-height:1.35}
.nodeLabel b{font-weight:600;font-size:15px;letter-spacing:-0.01em}
.nodeLabel span{font-size:12.5px;font-weight:400;color:#334155}
.cluster-label span.nodeLabel{display:inline-block;background:#FFFFFF;color:#0B2A3F;border:1.5px solid #0072B2;border-radius:999px;padding:2px 12px;font-size:11.5px;font-weight:700;letter-spacing:.09em;text-transform:uppercase}
.flowchart-link{stroke-width:1.75px}
.labelBkg{background:transparent!important}
span.edgeLabel{display:inline-block;background:#FFFFFF!important;color:#1E293B;border:1px solid #94A3B8;border-radius:999px;padding:2px 10px;font-size:12px;font-weight:500}
span.edgeLabel p{background:transparent!important}
.label-icon{width:20px;height:20px;vertical-align:-4px;margin-right:6px}
.icon-shape path[stroke-width="0"][fill="none"]{fill:#FFFFFF;stroke:#FFFFFF;stroke-width:12px;stroke-linejoin:round}
.icon-shape p{background:transparent!important;color:#0F172A}
.ingest .label-icon{color:#0E8A7D}
.xform .label-icon{color:#7B4FB0}
.load .label-icon{color:#0072B2}
.bus .label-icon{color:#A8517F}
.store .label-icon{color:#00785A}
.ui .label-icon{color:#D9480F}
.ext .label-icon{color:#64748B}
---
flowchart TB
accTitle: L4 Detail -- Module dependencies
accDescr: The format, grok and time modules build on parse and field. Parse, scrub, expr and ua build on strmatch, and strmatch's last tier runs the regex engine. Each box names the feature that gates it.
subgraph built["Built on parse"]
direction LR
format("<b>format</b><br/><span>parse</span>")
grok("<b>grok</b><br/><span>parse-grok</span>")
time("<b>time</b><br/><span>time</span>")
end
subgraph core["Parse layer"]
direction LR
parse("<b>parse</b><br/><span>parse</span>")
field("<b>field</b><br/><span>parse</span>")
end
subgraph users["Built on strmatch"]
direction LR
scrub("<b>scrub</b><br/><span>scrub</span>")
expr("<b>expr</b><br/><span>expr</span>")
ua("<b>ua</b><br/><span>ua</span>")
end
strmatch("<b>strmatch</b><br/><span>strmatch</span>")
regex("<b>Regex engine</b><br/><span>regex-automata</span>")
built --> core
core -->|"signatures"| strmatch
users -->|"signatures"| strmatch
strmatch -->|"last tier"| regex
format ~~~ grok ~~~ time
parse ~~~ field
scrub ~~~ expr ~~~ ua
built ~~~ users
class regex ext
class format,grok,time,parse,field,scrub,expr,ua,strmatch part
%% merrow:begin
classDef ingest fill:#FFFFFF,stroke:#0E8A7D,stroke-width:3px,color:#0F172A
classDef xform fill:#FFFFFF,stroke:#7B4FB0,stroke-width:3px,color:#0F172A
classDef load fill:#FFFFFF,stroke:#0072B2,stroke-width:3px,color:#0F172A
classDef bus fill:#FFFFFF,stroke:#A8517F,stroke-width:3px,color:#0F172A
classDef store fill:#FFFFFF,stroke:#00785A,stroke-width:3px,color:#0F172A
classDef ui fill:#FFFFFF,stroke:#D9480F,stroke-width:3px,color:#0F172A
classDef ext fill:#F4F6F8,stroke:#94A3B8,stroke-width:1.5px,stroke-dasharray:5 4,color:#0F172A
classDef decision fill:#FFFFFF,stroke:#9A6700,stroke-width:3px,color:#0F172A
classDef error fill:#FFFFFF,stroke:#C2410C,stroke-width:3px,color:#0F172A
classDef control fill:#FFFFFF,stroke:#334155,stroke-width:3px,color:#0F172A
classDef part fill:#FFFFFF,stroke:#94A3B8,stroke-width:1.5px,color:#0F172A
style built fill:none,stroke:#0072B2,stroke-width:1.5px,stroke-dasharray:6 4
style core fill:none,stroke:#0072B2,stroke-width:1.5px,stroke-dasharray:6 4
style users fill:none,stroke:#0072B2,stroke-width:1.5px,stroke-dasharray:6 4
%% merrow:end
Figure 1. L4 Detail -- Module dependencies. Grok's fallback and scrub's rules call the regex engine directly, not through strmatch, and xml, json and domain build on no other module. Up: L3 Components -- grippo.
- API reference: https://docs.rs/grippo
- docs/architecture.md: the parts and how a record moves through them.
- docs/parse.md, docs/formats.md, docs/grok.md, docs/strmatch.md and docs/field.md: parsers and primitives.
- docs/scrub.md and docs/xml.md: redaction and XML.
- docs/async.md: threads, tokio and what to share.
- docs/performance.md: every bench, its numbers and what they decided.
The default features are strmatch and parse. Each stock format, grok, scrub and XML sits behind a flag of its own, so a build holds what it uses. docs/feature-flags.md has the full list.
Your binary's build decides how fast grippo runs: the CPU flags, the release profile and a profile-guided build are in docs/build-optimisation.md.
Help, contributing and licence
A bug or a question goes in an issue. CONTRIBUTING.md has how to work in this repo and the commands that test a change. Security reports follow SECURITY.md.
Apache-2.0. Third-party attributions are in NOTICE.
You need your grippo in the wet.