I want to enrich incoming ECS-compatible documents with a tag if they come from VPN IPs.
From my testing, the enrich processor cannot deal with IP-ranges. However, i want to use IP-ranges and not manually (or by a script) spell out thousands of IPs for the enrich policy. What's the best strategy to achieve this?
Summary
PUT test-ip-range-lookup
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"properties": {
"ip": {
"type": "ip_range"
}
}
}
}
POST test-ip-range-lookup/_doc/vpn-ips
{
"ip": "192.168.0.0/16",
"tags": ["vpn-ip"]
}
PUT _enrich/policy/test-ip-enrich
{
"match": {
"indices": "test-ip-lookup",
"match_field": "ip",
"enrich_fields": ["tags"]
}
}
POST _enrich/policy/test-ip-enrich/_execute
POST _ingest/pipeline/_simulate
{
"docs": [
{
"_source": {
"host": {
"ip": "192.168.0.1"
}
}
}
],
"pipeline": {
"processors": [
{
"enrich": {
"policy_name": "test-ip-enrich",
"field": "host.ip",
"target_field": "tags",
"ignore_missing": true
}
}
]
}
}