Mikrotik Tutorial: How to configure persistent logging

Mikrotik Tutorial: How to configure persistent logging

The default logging configuration on a MikroTik router is to only keep logs in memory. When the router reboots the logging history is erased. In this article I will show you the simple steps to configure persistent logging to disk.

Steps to configure persistent logging

  1. In Winbox, choose System | Logging
  2. On the Rules tab, double-click each default rule
  3. Click Copy and change the Action dropdown to disk
  4. Press OK to save the new rule
  5. Repeat these steps for each of the 4 default logging rules (critical, error, info, and warning).

Here is what my logging rules look like after creating the 4 new rules.

Log File Retention Settings

Under the Actions tab, you can define the filename, file size and number of rotated log files to keep.  For disk performance reasons, I recommend a max of 4096 lines per log file.  You can also prefix the filename with the path to an external usb thumb drive to keep your logs separate from the built-in flash memory.

One side affect to configuring persistent logging is that the WinBox Log viewer will show duplicate entries.  To remove the duplicates, choose either memory or disk from the top, right-hand dropdown.  It will revert to all each time you reopen the Log window.

Now when you router reboots your log file(s) will be preserved.  Thanks for following along and I hope this tutorial helped you out.  Leave a comment below and checkout my other MikroTik Tutorials

NetScout LinkRunner G2

LinkRunner G2 is the ultimate network cable test tool


CAT5 Cable Tester, Measure Cable Length,
PoE Voltage, Network Connectivity, Switch Port ID
Optional Wireless & Fiber Optics Modules
Check Price on Amazon

6 Replies to “Mikrotik Tutorial: How to configure persistent logging”

  1. Thanks for making a significant amount of knowledge available. I run a small (600 uTiks) rural ISP, and effective management is quite tricky. Thanks again.

  2. Hi,

    I am wondering, why don’t you just change everything from memory to disk?
    Why should the router have to write everything twice?

    Is there something wrong with not writing logs to memory?

    Thanx,

    1. I’m using external flash drive for logging in addition to memory. I guess if something wrong will happen with flash drive, there will be any records in memory logs at least. So dubbing is useful.

  3. Hi,, all that is fine but..how do I rotate my logs.. I need to troubleshoot ipsec behaviour and I need to check the logs from about 30 minuts before the failure, I would not mind keeping a lot of files and then delete them myself, but when will it stop or recycle the files, ? is there an option for that ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.