From 7753c45bfb54a01bbcfc666a4df43aac227a25e0 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards More details on usage now follow.
Lookup table files consist of a header line and data lines, all inside a plain
-text file.
+ Lookup table files contain a single JSON object. This object contains of a header and a
+table part.
The header line is required to be
- Note that case is important, so "lookuptable" would be invalid.
-This is intentional to protect against false positives. The version parameter
+ The header is the top-level json. It has paramters "version", "nomatch", and "type".
+The version parameter
must be given and must always be one for this version of rsyslog. The nomatch
parameter is optional. If specified, it contains the value to be used if lookup()
is provided an index value for which no entry exists. The default for
-"nomatch" is the empty string. Note that for version 1,
-parameters must be provided in the order as specified above.
- Lines starting with "#" are comments and will be ignored. Leading whitespace before the
-comment character is permitted.
+"nomatch" is the empty string. Type specifies the type of lookup to be done.
+ This is a sample of how an ip-to-office mapping may look like:
This statement defines and intially loads a lookup table. Its format is
as follows:
Lookup Table File Format
-Header
-
-LookupTable version="1" nomatch="string"
-
-Data Lines
-Each data line must follow this format:
-
-"index"="value" # comment
-
-Where "index" and "value" are the actual values to be used. Standard escapes can be used,
-most importantly '\"' represents the double quote characters. Whitespace is ignored, as
-is everything after the comment character.
-Comment Lines
-Table
+This must be an array of elements, even if only a single value exists (for obvious
+reasons, we do not expect this to occur often). Each array element must contain two
+fields "index" and "value".
Example
-LookupTable version="1" nomatch="unk"
-# IP 10.0.1.0/1/2 belong to office A
-"10.0.1.0"="A"
-"10.0.1.1"="A"
-"10.0.1.2"="A"
-# IP 10.0.2.0/1/2 belong to office B
-"10.0.2.0"="B"
-"10.0.2.1"="B"
-"10.0.2.2"="B"
-# if a different IP comes in, the value "unk"
-# is returend thanks to the nomatch parameter in
-# the first line.
+{ "version":1, "nomatch":"unk", "type":"string",
+ "table":[ {"index":"10.0.1.1", "value":"A" },
+ {"index":"10.0.1.2", "value":"A" },
+ {"index":"10.0.1.3", "value":"A" },
+ {"index":"10.0.2.1", "value":"B" },
+ {"index":"10.0.2.2", "value":"B" },
+ {"index":"10.0.2.3", "value":"B" }
+ ]
+}
-
+Note: if a different IP comes in, the value "unk"
+is returend thanks to the nomatch parameter in
+the first line.
+RainerScript Statements
lookup_table() Object
-lookup_table(name="name" file="/path/to/file" type="static|dynamic"
- reloadOnHUP="on|off")
+lookup_table(name="name" file="/path/to/file" reloadOnHUP="on|off")
Parameters
@@ -95,11 +82,6 @@ lookup_table(name="name" file="/path/to/file" type="static|dynamic"
must be readable for the user rsyslog is run under (important
when dropping privileges). It must point to a valid lookup
table file as described above.
-
- Set the type of this lookup table. Only dynamic tables
- can be reloaded during runtime, but perform a bit
- less well for the same reason (for details see
- intro text).
Specifies if the table shall automatically be reloaded
as part of HUP processing. For static tables, the
@@ -202,7 +184,7 @@ be sufficiently secured, e.g. via TLS mutual auth.
[manual index] [rsyslog site]
This documentation is part of the
rsyslog project.
-Copyright © 2008-2013 by Rainer Gerhards and
+Copyright © 2013 by Rainer Gerhards and
Adiscon.
Released under the GNU GPL version 3 or higher.