mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 18:14:11 +02:00
filter logs by request id
This commit is contained in:
parent
f0e87de7df
commit
8cebac7905
2 changed files with 14 additions and 3 deletions
|
|
@ -83,7 +83,14 @@ impl LogMatch {
|
|||
filter.matches(statement.pattern)
|
||||
|| filter.matches(statement.path)
|
||||
|| filter.matches(statement.path_prefix)
|
||||
|| statement.placeholders.iter().any(|placeholder| filter.matches(placeholder))
|
||||
|| statement
|
||||
.placeholders
|
||||
.iter()
|
||||
.any(|placeholder| filter.matches(placeholder))
|
||||
|| statement
|
||||
.exception
|
||||
.filter(|exception| filter.matches(exception))
|
||||
.is_some()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ pub const TIME_FORMAT: EncodedConfig = Config::DEFAULT
|
|||
pub struct LogLine<'a> {
|
||||
#[serde(default)]
|
||||
pub index: usize,
|
||||
#[serde(rename = "reqId")]
|
||||
pub request_id: TinyAsciiStr<32>,
|
||||
pub version: &'a str,
|
||||
pub level: LogLevel,
|
||||
pub message: Cow<'a, str>,
|
||||
|
|
@ -131,8 +133,10 @@ impl<'a> LogLine<'a> {
|
|||
if filter.is_empty() {
|
||||
return true;
|
||||
}
|
||||
// todo: reqid, more?
|
||||
filter.matches(&self.app) || filter.matches(&self.message)
|
||||
// todo: exception, more?
|
||||
filter.matches(&self.app)
|
||||
|| filter.matches(&self.message)
|
||||
|| filter.matches(self.request_id.as_str())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue