accesslog 0.0.1
“Parse web server access logs (nginx, Apache httpd) by compiling the server's own log format definition”
Contains an unbounded block loopRust test marker or harness
SHA-25662ae62defeece61f48b3a5310e9eb72f56439a50ce9d310b414c4b77c3f83338
MaleculeH₂(CmDb)Md(Pa)
Evidence
1:30… compiler (mod_log_config).
2
3use alloc::string::{String, ToString};
4use alloc::vec::Vec;
5
6use crate::format::{
7 Builder, Escape, FieldKind, FieldSpec, Format, FormatError, FormatErrorKind, Role, Server,
8};
9
10pub(crate) const COMMON: &str = "%h %l %u %t \"%r\" %>s %b";
11/// The upstream httpd.conf definition. Debian and Ubuntu ship `%O` in place of `%b`.
12pub(crate) const COMBINED: &str = "%h %l %u %t \"%r\" %>s %b …
81:26… | b[i] == b'\'' {
82 let q = b[i];
83 i += 1;
84 loop {
85 match b.get(i) {
86 None => {
87 return Err(FormatError::new(FormatErrorK …
332:70… ),
333 };
334 (None, FieldKind::Integer, Escape::None, role)
335}
336
337#[cfg(test)]
338mod tests {
339 use super::*;
340 use crate::format::Segment;
341
342 fn sources(f: &Format) -> Vec<&str> {
343 f.fields().iter().map(|f| f.source()).collect()
344 }
345
346 #[test]
347 fn logformat_line() {
348 let f = compile(
349 r#"LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User …
16//!
17//! let log = b"192.0.2.7 - - [10/Oct/2026:13:55:36 +0000] \"GET /search?q=a%20b HTTP/1.1\" \
18//! 200 512 \"-\" \"curl/8.5 \\x22quoted\\x22\" \"198.51.100.1\"\n";
19//!
20//! for result in format.lines(log) {
21//! let record = result.unwrap();
22//! assert_eq!(record.client_address(), Some(&b"192.0.2.7"[..]));
23//! assert_eq!(record.status(), Some(200 …
⋯5 lines
114}
115
116#[cfg(test)]
117mod tests {
118 use super::*;
119
120 #[test]
121 fn nginx_default() {
122 assert_eq!(
⋯7 lines
Showing the top 5 files — 2 more files (25 regions) not shown.
No evidence locations were recorded for this file. Raw result