Logstash match value form external file


(Md Ghulam Khaja) #1

I want to filter out logs which contains specific IP mapped from external file.

DefaultUdpTransportMapping@182e8b8peerAddress=192.168.4.x, processed=false

I have a txt file which contains list of IP line by line. I want to match these against the received logs.
lets say

192.168.4.x
192.168.10.x
192.168.15.x

How I can achieve this in logstash?


(Magnus Bäck) #2

Use a translate filter.


(Md Ghulam Khaja) #3

Hey Magnus, Translate filter is to translate matched value from dictionary. My requirement is based on match I want to output to kafka. So If IP match is success output log to kafka. Can you please explain how comparison works on Translate filter?


(Magnus Bäck) #4

The translate filter lets you set a field value based on the presence of, in your case, an IP address. Then use that field value in a conditional around your kafka output.


(Md Ghulam Khaja) #5

Thanks Magnus, I did the same before seeing your reply. I put a check in output filter before pushing to Kafka.

Thanks again


(Md Ghulam Khaja) #6

Do you have any workaround for refresh_interval not working in translate filter?


(Md Ghulam Khaja) #7

figured it out. Now refresh interval is working as expected.

Thanks Magnus for your valuable and clear cut reply.

You know, You are awsome..:slight_smile:


(system) #8

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.