How to remove strings from ROS logs

Hello everybody.
I have a problem with type-c LAN card of one of my laptops - it’s not going to sleep mode with laptop. It’s not an issue for me but it generates a looooot of logs like

ether2-LAN link down
ether2-LAN link up (speed 1G, full duplex)"

every 5 seconds.
Is it possible to delete these lines from ROS logs via script and scheduler?

I can only clean logs completely, but it’s not acceptable for me, so I’m looking for a way to clean only these lines. For now I found only the way how to get these records

:local string1 [/log find message~"ether2-LAN link down"];
:local string2 [/log find message~"ether2-LAN link up (speed 1G, full duplex)"];

, but I don’t know how to delete them.



Thanks in advance.

You cannot delete lines from log.

What you could do (with some IMHO not-so-trifling scripting) would be (periodically, let’s say once a day):

  1. print the log “as is” to file
  2. clear the log
  3. modify the file removing the lines you want to exclude
    Then - again periodically let’s say once a week - delete the log files.

Or you could exclude from logging all “info” data (maybe too much), or the ones with interface topic, using the /system logging topics:
https://wiki.mikrotik.com/wiki/Manual:System/Log

but there isn’t AFAIK some form of filtering based on content of the log entry.

Looks like I’ll use your suggestion an will disable logging with “info” level. Thanks.