Hallo to everyone, it's my first topic here.
scenario
I have to check if some IP are SECURE and i do it checking the value (send me by apache logs) by an external list and so i have to mark or add a field .
Create a dictionary with all SECURE IPs mapped to e.g. the string 'SECURE'. The create a lookup and populate a field with this. If the field then is not set you can assume it is not secure and label it MALICIOUS. Would that work?
If i undestood translate , transform a variable in other ... ad ex , IP convert in SECURE (or not SECURE) , i need match the variable with a list for mark an additional FLAG with the keyword.
My solutions :
ruby { code => "
f = File.open('/tmp/IP.lst','r')
ip = event['clientip']
text = f.read()
if text =~ /#{ip}/
event['ORIGIN'] = 'SECURE'
else
event['ORIGIN'] = 'MALICIOUS'
end
f.close()
puts event['ORIGIN']
"}
Translate allows you to perform a lookup against a dictionary based on the contents of a field, e.g. clientip, and populate a different field with the result, which could be SECURE or MALICIOUS as in your example. You could combine this with a conditional (the field containing the result of the lookup is not set) and use a mutate filter to then set it to MALICIOUS, which would be the default value. This should do what your Ruby filter does but avoid loading the file once for every event.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.