Hi, I have a lookup table with IP ranges and locations. The problem is in the IP range column there can be several IP ranges separated by comma. How can match the client IP address with the right location?
To use a CIDR match you need each row in the lookup to have a single row per CIDR block.
So if your lookup has comma separated CIDR blocks you need to split these into rows.
You can either do this by manually splitting the data and adding rows, or you could use |inputlookup, split the field, then mvexpand and re-write the (or create a new) lookup.
| makeresults
| eval cidr="192.168.1.0/24,192.168.30.0/24", location="London"
| table cidr location
| eval cidr=split(cidr,",")|mvexpand cidr
replace the first 3 lines with |inputlookup yourfile.csv
add at the end |outputlookup yourNewfile.csv to write a new file
| inputlookup yourfile.csv
| eval cidr=split(cidr,",")|mvexpand cidr
| outputlookup yourNewfile.csv
To use a CIDR match you need each row in the lookup to have a single row per CIDR block.
So if your lookup has comma separated CIDR blocks you need to split these into rows.
You can either do this by manually splitting the data and adding rows, or you could use |inputlookup, split the field, then mvexpand and re-write the (or create a new) lookup.
| makeresults
| eval cidr="192.168.1.0/24,192.168.30.0/24", location="London"
| table cidr location
| eval cidr=split(cidr,",")|mvexpand cidr
replace the first 3 lines with |inputlookup yourfile.csv
add at the end |outputlookup yourNewfile.csv to write a new file
| inputlookup yourfile.csv
| eval cidr=split(cidr,",")|mvexpand cidr
| outputlookup yourNewfile.csv
Thanks, I was afraid of that answer.