From 9afbf7d06c3092beb5cd811784546e5a75f1dfac Mon Sep 17 00:00:00 2001 From: Mark Schmale Date: Tue, 11 Sep 2018 17:42:20 +0200 Subject: [PATCH] added a basic readme. added IDE files to gitignore. --- .gitignore | 4 +++- README.md | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/.gitignore b/.gitignore index d0517e5..8bdac5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /target **/*.rs.bk -sample/ \ No newline at end of file +sample/ +nginx-log-parser.iml +.idea/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..fdbefcd --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# nginx_log_parser + +A rust library to read nginx log files. + +Takes a nginx-like syntax for the format and generates a parser that reads log lines. +```rust +extern crate nginx_log_parser; +use nginx_log_parser::Format; + +let format = Format::from_str("$remote_addr [$time_local] $request").unwrap(); +let entry = format.parse("1.2.3.4 [11/Sep/2018:08:44:17 +0000] GET / HTTP/1.1"); +assert_eq!(Some("GET / HTTP/1.1"), entry.unwrap().get("request")); +``` + +## To be done + - more tests + - make the parser fast (do not use a full-featured-regex engine) \ No newline at end of file