Logstash match value form external file

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?

Use a translate filter.

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?

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.

1 Like

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

Thanks again

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

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:

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