LogForwarder filtering

Prev Next

When forwarding audit logs using TCP or Kinesis, you can apply advanced filtering so that only specific log records are forwarded. You can configure multiple destinations — for example, two TCP clients — each with its own filter. Any log records that do not match a configured filter are dropped.

Configure filters by entering a single Boolean expression in the Filter field. Filter expressions use JMESPath syntax. For a full reference, see JMESPath Tutorial.


Example log record

The following is an example ip_access log record:

{
 "version": 2,
 "timestamp": "2021-05-26T12:52:45.234Z",
 "hostname": "ec2-3-84-47-238.compute-1.amazonaws.com",
 "daemon": "cz-vpnd",
 "log": {
         "action": "allow",
         "action_id": "allToall#d946ec12-035e-34f5-a78e-36af4d373339",
         "client_ip": "84.216.154.236",
         "client_port": 43854,
         "collective_id": "408bda4e-36c7-4041-b821-82b18534ad9b",
         "connection_type": "new",
         "destination_ip": "10.0.23.209",
         "destination_port": 22,
         "direction": "up",
         "distinguished_name": "CN=55c2bc7427c14e458895661909dc3f16,CN=test,OU=local",
         "distinguished_name_device_id": "55c2bc7427c14e458895661909dc3f16",
         "distinguished_name_ou": "local",
         "distinguished_name_user": "admin",
         "entitlement_token_id": "dc93a41f-3314-4c74-9a92-beec8d1574a9",
         "event_type": "ip_access",
         "geoip": {
                 "city_name": "Nygard",
                 "continent_code": "EU",
                 "cordinates": [13.4667, 57.55],
                 "country_code2": "SE",
                 "country_code3": "SE",
                 "country_name": "Sweden",
                 "ip": "84.216.154.236",
                 "latitude": 57.55,
                 "location": {
                         "lat": 57.55,
                         "lon": 13.4667
                 },
                 "longitude": 13.4667,
                 "postal_code": "514 54",
                 "region_code": "O",
                 "region_name": "Västra Götaland",
                 "time_zone": "Europe/Stockholm"
         },
         "id": "ecf2cdb5-0878-4b33-805b-0f1a1ae1b390",
         "packet_size": 60,
         "protocol": "TCP",
         "rule_name": "allToall-0",
         "source_ip": "192.168.100.1",
         "source_port": 50510,
         "timestamp": "2021-05-26T12:52:45.234Z",
         "version": 15
 }
}

Filter expression examples

The following table shows example filter expressions:

Goal

Filter expression

Forward only ip_access logs

log.event_type=='ip_access'

Forward all logs except ip_access

log.event_type!='ip_access'

Forward logs for access to a specific IP address

log.destination_ip=='10.0.23.209'

Forward logs for access to a specific IP address and port

log.destination_ip=='10.0.23.209' && log.destination_port==22