-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogfmt.ebnf
46 lines (36 loc) · 927 Bytes
/
logfmt.ebnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(*
* Grammar for Apache's LogFormat as implemented by liblf
* https://httpd.apache.org/docs/current/mod/mod_log_config.html#logformat
* EBNF, ISO/IEC 14977:1996(E)
* Terminals are uppercase, as defined per ABNF (RFC 5234 B.1 Core Rules)
*)
logfmt = { literal | directive | "%%" }
;
(* XXX: OCTET - ( "\" | "%" ) *)
literal =
OCTET
| "\t" | "\n" | "\'" | '\"' | "\\"
;
(* XXX: OCTET - "}" *)
name = { OCTET }
;
name-specifier = "C" | "e" | "i" | "n" | "o" | "^ti" | "^to"
| custom-specifier
;
nameless-specifier =
"A" | "a" | "B" | "b" | "D" | "f" | "h" | "H" | "I" | "k" | "l" | "L"
| "m" | "O" | "p" | "P" | "S" | "T" | "t" | "U" | "u" | "V" | "v" | "X"
| custom-specifier
;
custom-specifier =
ALPHA
;
directive =
"%", [ predicate ], [ "<" | ">" ],
( "{", name, "}", ( name-specifier )
| nameless-specifier )
;
status = DIGIT, { DIGIT } ;
predicate =
[ "!" ], [ status, { ",", status } ]
;