pub struct CompiledFilter {
pub format_name: String,
/* private fields */
}Expand description
A compiled filter bound to a specific format. Evaluating a line runs the format’s regex once and applies all predicates against the resulting captures. AND semantics: a line matches iff every predicate matches.
format_regex_record is a sibling compiled from the same source pattern
with dotall + multi-line flags enabled. Records-mode callers use it so
greedy . / .+ captures span across newlines within a single record
(e.g. (?P<message>.*)$ captures the entire record body instead of
failing because the original $ only matches end-of-input).
Fields§
§format_name: StringImplementations§
Source§impl CompiledFilter
impl CompiledFilter
Sourcepub fn compile(
format: &LogFormat,
specs: Vec<FilterSpec>,
) -> Result<Self, String>
pub fn compile( format: &LogFormat, specs: Vec<FilterSpec>, ) -> Result<Self, String>
Compile the given specs against format. Validates that every spec’s
field is one of the format’s named captures.
Sourcepub fn evaluate(&self, line: &[u8]) -> FilterMatch
pub fn evaluate(&self, line: &[u8]) -> FilterMatch
Evaluate the filter against a single logical line of bytes. Decodes the line as UTF-8 with a lossy fallback so non-UTF-8 bytes can still flow through (they just won’t match string-equal predicates).
Sourcepub fn evaluate_record(&self, record: &[u8]) -> FilterMatch
pub fn evaluate_record(&self, record: &[u8]) -> FilterMatch
Records-mode evaluation: runs the format regex with dotall + multi-line
flags enabled against the full multi-line record bytes. Greedy
captures like (?P<message>.*)$ consume the whole body of the record,
so predicates can match content on any continuation line.