How to clear log

Hi, I want to clear log page. It is 7 MiB, I don’t want it to keep adding new log informations, I just want to delete past ones so new logs come easily.

you can enter in System Logging, and disable all logging report..thats all you have to do..

ThankYou

I don’t want to disable, I just want to clear log information.

If your way is not disabling. Can you tell me how to do that?

This is how I usually do it:

  1. Go to system > logging > actions
  2. double click the ones you want to change (e.g: disk), change the “Lines” value to 1. It will delete all previous entries.
  3. Change it back to the desired number of lines.
  4. All done. ^^

Well, I disabled the rules part than enabled it. :laughing:

Uhhh, you do want to CLEAR the old log entries, no?

Disabling the rules then re-enabling it won’t clear the old entries. In fact, it will add a “log rule changed by…” line for every rule you disable, then another one when you enable it.

Oh well, if you managed to do what you want to do… :slight_smile:

You can also reboot. All not stored on disk logs are gone…

But indeed, a nice feature of winbox would be a ´clear log files´ button. :smiley:

That didn’t worked.

Yes I cleared by disabling I’m using 2.9.x

v3.19 no method described removed the logs saved on disk, they can still be seen in Logs. I did not reboot the router. Maybe after rebooting they will disappear. I changed the settings, disabled, enabled, now all settings are back to normal - critical and warning are set to disk. I hope this does not cause the old logs to remain after a reboot.

But this is stupid. MikroTik team, just make a “clear logs” feature. Thank you.

I logged in today and logs were gone. Router has not been rebooted due to power outage during night. Only logs that were set to memory were there and one line of log on disk. This still feels stupid.

p.s. because of below post I can clarify: I mean that the router has not been rebooted. And that I guess that when it is rebooted due to one reason or other the logs could be gone then and the result from the silly actions taken could be seen then. Which is not good because nobody wants router downtime, right? Right. And ps.2 we are talking about disk logs here. Please reed closely before posting early in the morning :wink:

Well, what you write makes no sense.
“Router has not been rebooted due to power outage”
If you have had a power outage your router HAS been rebooted. Or you must have found the first router that doesn’t need power to work… :smiley:

Second, if the router reboots all memory log files are lost due the power loss of the cpu.
So that makes it impossible that you still have memory recorded logs from before the reboot…

Every log line written to disk should be there after a reboot, if not you better check your disk.

Rudy

Add this script, it is a work around…

/system script
add name=“Clear Log” policy=ftp,reboot,read,write,policy,winbox,password,sniff source=
“/system logging action\r
\nset 0 memory-lines=1\r
\nset 0 memory-lines=100”

Unfortunately this method no longer works. I have done a feature request for a “clear log” function to be added.

Except hiding malicious actions, what purpose would this have?

1 Like

Two reasons I can think of, both have affected me over the last few days:

  1. For debugging purposes I really don’t care about the history at this particular moment in time and would like to clear the log, try something and look at a minimized version of the log that hasn’t been filled by my previous 2994 attempts at debugging. It would help a great deal if the log only shows the information that is useful to me at this point in time. It has happened in the past where I’ve confused a previous runs results with the latest runs result when there is actually a flaw in the script causing it not to run at all. Some scripting errors don’t print any output to the log even if critical failures occur and it’s easy to confuse results.
  2. When debugging issues over a really crappy Internet line, I’ve noticed that sometimes the log is so overbearing that when you connect in Winbox it tries to load the last months logs it causes the connection to disconnect. It drops you, and then when you log in again it tries to do the same thing again and again until you are lucky enough to be able to close the log window. Then you can do what you actually need to do.

Edit: If I really wanted to hide any malicious actions I could just reboot it which would clear the log anyway…

Make a new logging action=file, then make a new logging rule with this action. after done debugging, delete it.

I’ll try that.

What about adding support for a ring buffer where it deletes the oldest and moves everything up as an alternative to “Stop on Full”?

I’ve tried this and it would work okay if I could create my own topic. But because the topic field is hardcoded I have to try and choose one which hopefully won’t carry other traffic. This seems like a whole lot of unnecessary stuff just to try and get to a point where I can reduce the amount of noise on the screen. The router should not be compromised in the first place. If the router has been compromised and the person is able to click the “clear log” button then he has already won. I don’t see how the lack of a “clear log” button is somehow going to improve security.

  1. Go to System Logging Actions Add name=Temp type=disk file-name=mylog
  2. Go to System Logging Rules Add topic=info prefix=cheese action=temp
  3. Log info “cheese: custom message”

But because the topic field is hardcoded I have to try and choose one which hopefully won’t carry other traffic.

Just make one identical to the default you use. Critical/Error/Info/Warning are the defaults that go into your LOG screen.