v0.26.1
This commit is contained in:
1 parent
ddc5c6593f
commit
b9d137eee1
63 files changed
+1232
-445
No files matched your search
@@ -55,6 +55,37 @@
|
||||
assert!(validate_file_log_query(&query).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stored_log_normalizes_mapped_client_ip_and_searches_diagnostics() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let source = source_from_path(
|
||||
"vhost:app".into(),
|
||||
"app.jsonl".into(),
|
||||
"access",
|
||||
dir.path().join("app.jsonl"),
|
||||
true,
|
||||
"JSONL",
|
||||
);
|
||||
let mut format = crate::logging::JsonFormat::default();
|
||||
format.fields.remove("client_ip");
|
||||
format
|
||||
.fields
|
||||
.insert("remote_addr".into(), "client_ip".into());
|
||||
let record = normalized_record(
|
||||
&source,
|
||||
r#"{"event":"protocol_error","remote_addr":"192.0.2.10","reason":"tls_handshake_error","error":"HTTP parser error","sni":"app.example.test","matched_by":"sni","vhost":"app"}"#,
|
||||
&format,
|
||||
);
|
||||
assert_eq!(record["client_ip"], "192.0.2.10");
|
||||
assert_eq!(record["sni"], "app.example.test");
|
||||
|
||||
let query = FileLogQuery::default();
|
||||
assert!(record_matches(&record, &query, "error"));
|
||||
assert!(record_matches(&record, &query, "http parser"));
|
||||
assert!(record_matches(&record, &query, "app.example.test"));
|
||||
assert!(!record_matches(&record, &query, "missing"));
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn stored_log_reader_refuses_symlink_targets() {
|
||||
|
||||
Reference in new issue
Block a user