Skip to content

Commit

Permalink
fixed issue with non-complaint lines
Browse files Browse the repository at this point in the history
  • Loading branch information
QpxDesign committed May 27, 2024
1 parent a0d7e01 commit e72c698
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
workspace = { members = [ "tests","tests/obfuscate_access_log_ips"] }
[package]
name = "ngxav"
version = "0.6.2"
version = "0.6.3"
edition = "2021"
license = "MIT"
description = "Search through NGINX logs with advanced filters and support for displaying analytics about your selected log entries"
Expand Down
14 changes: 14 additions & 0 deletions src/utils/parse_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ lazy_static! {
pub fn parse_line(line: &str) -> crate::structs::LineParseResult::LineParseResult {
let matches: Vec<&str> = R.find_iter(line).map(|mat| mat.as_str()).collect();
let mut fields = line.split(" ").collect::<Vec<_>>();
if fields.len() < 12 || matches.len() < 4 {
return crate::structs::LineParseResult::LineParseResult {
ip_address: "-",
time: "".to_string(),
host: "",
referer: "",
request: "",
status: "",
body_bytes_sent: 0,
request_time: 0,
user_agent: "",
full_text: line,
};
}
return crate::structs::LineParseResult::LineParseResult {
ip_address: fields[0],
time: fields[3].replace("[", "") + " " + &fields[4].replace("]", ""),
Expand Down

0 comments on commit e72c698

Please sign in to comment.