Skip to main content

Crate grippo

Crate grippo 

Source
Expand description

Grok, regex, CEL and scrubbing on typed primitives. Up to 9 times faster than the stock Rust regex.

Grok and regex are how a pattern is written, not how it runs. Every matcher and parser reports the MatcherTier it runs on, and the regex engine runs only when no native route covers the pattern.

§Sync by default, tokio when you ask

grippo is sync. It takes &[u8] and &str, loads no files and opens no sockets, so parsing, matching and scrubbing have no async form: call them on each record wherever it is. Bytes meet I/O only in grippo::io (the framing feature), where a stream is framed into records and records into a stream. io::Scanner and io::Writer do that with no I/O at all, and io::frames and io::write_frames run them over BufRead and Write. The tokio feature adds io::tokio, with the same two helpers over AsyncRead and AsyncWrite and the tokio-util codec under them. It never changes a sync item, and nothing else in grippo needs it.

Modules§

charsetcharset
UTF-16 and legacy code pages read as UTF-8.
composecompose
Typed primitives composed into a parser, with no pattern text.
convertconvert
Field text converted to a typed value: an integer, a float at single or double precision, a boolean or an IP address.
cost
What a primitive costs, beside the MatcherTier it runs on.
decodedecode-base64 or decode-gzip or decode-hex or decode-rsyslog or decode-snappy or decode-text or decode-zlib or decode-zstd
Parsers that decode their input and hand on the bytes, so a chain reads field("payload"):base64 > gzip > ndjson.
domaindomain
A host name split at its public suffix from the list psl compiles in: the suffix, the registrable domain one label above it, and the subdomain below that, each a span of the name as written.
exprexpr
CEL filter expressions lowered to prefix, suffix, substring, exact and number checks over a crate::record::Record, with no interpreter.
fieldparse
Field parsers for the common grok patterns.
formatparse
Stock parsers for standard formats, each behind its own feature and each a crate::parse::Parser to name in a chain. The ones with a literal in their signature are what auto detects.
grokparse-grok
Grok: a regex written with named sub-patterns.
ioframing
Records framed in and out of a byte stream, with no I/O of grippo’s own.
jsonjson-depth
A depth guard for untrusted JSON.
numberparse or record
A number’s text read as a value, by one of two stated readings.
parseparse
One Parser trait for every format, and a driver that runs a chain of them: syslog > cef > field("msg"):xml.
pathjson-paths or parse or scrub or xml
Field paths, and the field names grippo’s parsers write in the same grammar.
recordrecord
A record read by field path, whatever holds it: raw JSON bytes, a raw text line, the fields a parser chain wrote, or raw XML bytes with xml.
scrubscrub
Secret detection and redaction with gitleaks’ rules and gitleaks’ answers.
strmatchstrmatch
Regex patterns, run on the cheapest engine that gives the same answer.
timetime
Turn a matched timestamp into an instant, and write an instant out.
uaua
User agent strings read with a uap-core style rule table: the first rule whose regex matches names the browser, the operating system or the device, and its replacement fields fill in the answer.
uriuri
URI references split into borrowed parts.
windowswindows
A Windows command line split into arguments as the Microsoft C runtime reads it, each argument a span of the line.
xmlxml
XML to JSON records, mechanically: one input always gives the same output, with no per-source branches.

Enums§

Dialect
The regex language a pattern is written in. Rust’s regex syntax is the default.
MatcherTier
The engine class a matcher or parser runs on.