L
L
lolowin322021-09-03 17:24:31
Mikrotik
lolowin32, 2021-09-03 17:24:31

How to write ip addresses from MikroTik logs to a file?

Good afternoon, please tell me how to write ip addresses of scanning machines to a file on MikroTik? Here is an approximate microt log that needs to be processed, select outgoing ip addresses of machines and write them to a file
15:20:15 firewall,info WINBOX-SCAN input: in: ether2 out: (unknown 0), src-mac [MAC_ADDRESS], proto TCP (SYN), 46.72.224.142:64083->[WAN_IP]:8291, len 40
15:26:27 firewall,info WINBOX-SCAN input: in:ether2 out:(unknown 0), src-mac [MAC_ADDRESS], proto TCP (SYN), 46.72.63.34:146->[WAN_IP]:8291, len 40

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kprohorow, 2021-09-10
@kprohorow

Set up a syslog server and do parsing there.
Or, as noted above, fail2ban using the Mikrotik Firewall Filter.
Here is an article with detailed explanations about the second option.
https://interface31.ru/tech_it/2021/05/zashhita-rd...

S
Saboteur, 2021-09-03
@saboteur_kiev

grep -oP '\(SYN\), \K[0-9.]+' file.log > only_addresses.txt

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question