Filtering logs
After the logs are parsed, you can filter the logs to include relevant log data and exclude data that you do not require. For example, you set up the following grep configurations
Sample logs:
The value of the message field contains cool.
The value of the hostname field matches web<INTEGER>.example.com.
The value of the message field does NOT contain uncool.
The following logs are collected:
{"message":"It's cool outside today", "hostname":"web001.example.com"}
{"message":"That's not cool", "hostname":"web1337.example.com"}
The following logs are excluded:
{"message":"I am cool but you are uncool", "hostname":"db001.example.com"}
{"hostname":"web001.example.com"}
{"message":"It's cool outside today"}
To filter logs
- From the Log Filter list, select Grep.
- From the Directive field, select Regex (to include logs) or Exclude.
In the Key field, enter the key from the log expression.
Get the keys from the log expression. For example, in the Apache expression, host, user, time, method, path, code, size, refer, and agent are keys.
For CSV type of parser, keys are the field names that you entered for the columns in the CSV file.- In the Pattern field, enter the value to be included or excluded.
For Apache, Apache Error, Nginx, and Regexp, enclose the values within forward slashes (//). Click + to add another grep expression.