You can filter all collected log events on the vRealize Log Insight Linux agent based on their field values to specify which log events to pick or drop. You can use the whitelist and blacklist collector options to define filters.
For each log event, the collector evaluates the whitelist and blacklist filter expression. If the whitelist expression evaluates to true and the blacklist expression evaluates to false or cannot be evaluated, the event moves to the queue for further processing. In any other case, the collector drops the event. The default value of the whitelist expression is true and the default value of the blacklist expression is false.
Filelog
collector provides fewer fields for filtering. To obtain fields for filtering, you can parse the logs. For more information, see
Parsing Logs.
A whitelist or blacklist filter is a set of variables, literals, and operators that evaluates to a single logical or integer value. You use the log event fields as variables and double quoted strings and numbers as literals. For information about the operators that you can use within a filter expression, see Event Fields and Operators.
-
If you compare a number with a string or if the comparison involves numerical strings, each string is converted to a number and the comparison is performed numerically. For example:
- The expression
whitelist = 123.0 == "000123"
evaluates to true. - The expression
whitelist = "00987" == "987.00"
evaluates to true. - In the expression
whitelist = response_size >= "12.12"
, if theresponse_size
field has a numeric value, the expression is evaluated numerically. If the response size is greater than 12.12, the expression is true, else it is false. - In the expression
whitelist = "09123" < "234"
, both the string literals are converted to numeric values and the expression evaluates to false.
- The expression
-
If one of the string operands cannot be converted to numeric values, both the operands are converted to string. A simple case-sensitive lexicographical comparison is performed. For example:
- The expression
whitelist = "1234a" == "1234A"
is a string comparison that evaluates to false. - The expression
whitelist = 4 < "four"
converts 4 to "4" and evaluates to true. - In the expression
whitelist = response_size > "thousand"
, the value of theresponse_size
field is converted to a string value, which evaluates the expression to false.
- The expression
-
If a filter expression evaluates to an integer value, it is treated as false if it is 0 and true otherwise.
For example, the expression
whitelist = some_integer & 1
evaluates to true if thesome_integer
field has a least significant bit set and false otherwise.
For a complete list of log event fields and operators see Collect Log Events from a Log File.
127.0.0.1 - frank [10/Oct/2016:13:55:36 +0400] "GET /apache_pb.gif HTTP/1.0" 200 2326
198.51.100.56 - john [10/Oct/2016:14:15:31 +0400] "GET /some.gif HTTP/1.0" 200 8270
198.51.100.12 - smith [10/Oct/2016:14:15:31 +0400] "GET /another.gif HTTP/1.0" 303 348
198.51.100.32 - test [10/Oct/2016:15:22:55 +0400] "GET /experimental_page.gif HTTP/1.0" 400 46374
127.0.0.1 - test [10/Oct/2016:15:22:57 +0400] "GET /experimental_page2.gif HTTP/1.0" 301 100
Prerequisites
- Log in as root or use sudo to run console commands.
- Log in to the Linux machine on which you installed the vRealize Log Insight Linux agent, open a console and run pgrep liagent to verify that the vRealize Log Insight Linux agent is installed and running.