Skip to content
MikroTik RouterOS Docs

Logging Configuration

For the impatient: send logs to a remote syslog server.

/system logging action set [find name=remote] remote=192.168.1.100
/system logging add action=remote topics=info
/system logging add action=remote topics=warning
/system logging add action=remote topics=error

Verify with:

/log print follow

What this does: RouterOS logging captures system events and status information for monitoring, troubleshooting, and auditing. Logs can be stored in memory (RAM), written to disk files, displayed on console, sent via email, or transmitted to remote syslog servers.

When to use this:

  • Real-time monitoring of router events
  • Troubleshooting connectivity or configuration issues
  • Security auditing (login attempts, firewall matches)
  • Centralized log collection from multiple routers
  • Compliance and forensic analysis via SIEM integration

Prerequisites:

  • Network connectivity to syslog server (for remote logging)
  • Email server configuration (for email alerts)
  • Sufficient storage space (for disk logging)

Before configuring logging, check the existing log entries stored in memory.

/log print

To monitor logs in real-time:

/log print follow

Press Ctrl+C to stop following.

RouterOS includes five default logging actions that cannot be deleted.

/system logging action print

Expected output:

Flags: * - default
# NAME TARGET REMOTE
0 * memory memory
1 * disk disk
2 * echo echo
3 * remote remote 0.0.0.0
4 * email email

View the default logging rules:

/system logging print

Set the syslog server address on the default remote action.

/system logging action set [find name=remote] remote=192.168.1.100

Important: Create separate rules for each severity level. Topics are ANDed together, so topics=info,warning,error will match nothing (no log entry has all three severities simultaneously).

/system logging add action=remote topics=info
/system logging add action=remote topics=warning
/system logging add action=remote topics=error
/system logging add action=remote topics=critical

Confirm the logging rules are active.

/system logging print

Expected output:

Flags: X - disabled, * - default
# TOPICS ACTION PREFIX
0 * info memory
1 * error memory
2 * warning memory
3 * critical echo
4 info remote
5 warning remote
6 error remote
7 critical remote

Route only firewall and authentication events to the syslog server.

/system logging add action=remote topics=firewall
/system logging add action=remote topics=account
/system logging add action=remote topics=ssh

Create a dedicated syslog action with custom facility for filtering.

/system logging action add name=syslog target=remote \
remote=192.168.1.100 remote-port=514 \
syslog-facility=local0 syslog-severity=auto \
syslog-time-format=bsd-syslog
/system logging add action=syslog topics=info
/system logging add action=syslog topics=error

Send logs in Common Event Format for SIEM systems.

/system logging action add name=siem target=remote \
remote=10.0.0.50 remote-port=514 remote-protocol=tcp \
remote-log-format=cef cef-event-delimiter="\r\n"
/system logging add action=siem topics=info
/system logging add action=siem topics=firewall

Store logs to disk for retention after reboot.

/system logging action add name=disk-log target=disk \
disk-file-name=log disk-lines-per-file=1000 disk-file-count=5
/system logging add action=disk-log topics=firewall

View disk log files:

/file print where name~"log"

Avoid NAND wear by logging to external USB storage.

/system logging action add name=usb-log target=disk \
disk-file-name=usb1/router-log disk-lines-per-file=5000 disk-file-count=10
/system logging add action=usb-log topics=firewall
/system logging add action=usb-log topics=web-proxy

Receive email notifications for critical system events.

First, configure the email server:

/tool e-mail set server=smtp.example.com port=587 \
start-tls=yes user=alerts@example.com password=yourpassword

Then create the email logging action:

/system logging action add name=email-alerts target=email \
email-to=admin@example.com email-start-tls=yes
/system logging add action=email-alerts topics=critical
/system logging add action=email-alerts topics=account

Create isolated buffers for specific topics to simplify troubleshooting.

/system logging action add name=dhcp-debug target=memory memory-lines=500
/system logging add action=dhcp-debug topics=dhcp
/log print where buffer=dhcp-debug

Track specific firewall rule matches using prefixes.

First, add firewall rules with logging:

/ip firewall filter add chain=input action=drop log=yes log-prefix="DROP_INPUT:" \
connection-state=invalid

Then create a logging rule (note: prefix adds text to messages, does not filter by prefix):

/system logging action add name=fw-drops target=memory memory-lines=2000
/system logging add action=fw-drops topics=firewall

Send logs through a specific VRF.

/system logging action add name=mgmt-syslog target=remote \
remote=10.99.0.10 vrf=management

Assign different syslog facilities to each router for server-side filtering.

# Router 1
/system logging action set remote syslog-facility=local0
# Router 2
/system logging action set remote syslog-facility=local1
# Router 3
/system logging action set remote syslog-facility=local2

Confirm your logging configuration is working.

/system logging action print where target=remote

Expected: Remote address shows your syslog server IP.

/system logging print

Expected: Rules showing your topics mapped to appropriate actions.

/tool sniffer quick host=192.168.1.100 port=514

Expected: UDP packets to syslog server when log events occur.

:log info "Test message from RouterOS"

Then verify it appears:

/log print where message~"Test message"
SymptomCauseSolution
Remote syslog not receiving logsFirewall blocking UDP 514Check outbound firewall rules; allow UDP 514
Remote syslog not receiving logsTopics combined incorrectlyCreate separate rules for each severity (info, warning, error, critical)
Remote syslog not receiving logsWrong syslog server IPVerify with /system logging action print
Topics missing in syslog messagesBSD syslog format limitationUse log prefix or different facilities per topic
Cannot clear memory logsRouterOS version too oldUpgrade to v7.20+ or reduce memory-lines temporarily
Disk logs wearing out NANDHigh-frequency loggingUse USB storage or remote syslog instead
Email alerts not sendingEmail not configuredConfigure /tool e-mail first
Reboot messages not in remote syslogNetwork unavailable during bootUse disk logging for system topic

Common Mistakes

  • Don’t combine multiple severity levels in one rule - topics=info,warning,error matches nothing because topics are ANDed. Each log entry has only ONE severity level.
  • Don’t confuse prefix behavior - The prefix property adds text to messages, it does NOT filter by prefix.
  • Don’t log high-frequency topics to internal NAND - Firewall and web-proxy topics can cause flash wear. Use external storage or remote syslog.
  • Don’t expect immediate remote logs during reboot - Network isn’t available during early boot/late shutdown. Boot messages only go to memory/disk.
  • Cannot delete default actions - The five default actions (memory, disk, echo, remote, email) cannot be deleted or renamed. Create new actions instead.
TopicDescription
criticalCritical system events
errorError conditions
warningWarning conditions
infoInformational messages
debugDebug-level messages
packetPacket-level details
rawRaw packet data
TopicDescription
accountUser login/logout events
bgpBGP routing protocol
dhcpDHCP server/client events
dnsDNS operations
firewallFirewall rule matches
interfaceInterface state changes
ipsecIPsec VPN events
ospfOSPF routing protocol
pppPPP connections
routeRouting table changes
scriptScript execution
sshSSH access
systemSystem events (startup, shutdown)
wirelessWireless events
wireguardWireGuard VPN events

Use ! to exclude topics:

/system logging add action=remote topics=info,!firewall

This logs all info messages except those also tagged firewall.

FacilityTypical Use
daemonDefault; general system daemons
local0 - local7Custom applications; use for multi-router identification
authAuthentication events
syslogSyslog-related messages
userUser-level messages
PropertyTypeDefaultDescription
namestring-Action identifier (required)
targetmemory/disk/echo/remote/emailmemoryDestination type
memory-lines1-655351000Lines stored in RAM buffer (memory target)
disk-file-namestringlogBase filename (disk target)
disk-lines-per-file1-65535100Lines per file before rotation
disk-file-count1-655352Number of rotating files
remoteIP[:port]0.0.0.0:514Syslog server address
remote-portinteger514Syslog server port
remote-protocoltcp/udpudpTransport protocol
remote-log-formatcef/default/syslogdefaultOutput format
syslog-facilityenumdaemonRFC 3164 facility
syslog-time-formatbsd-syslog/iso8601bsd-syslogTimestamp format
vrfnamemainVRF for remote logging (v7.19+)
email-tostring-Recipient address (email target)
PropertyTypeDescription
actionstringAction name for matching logs
topicsstringComma-separated topic list (ANDed)
prefixstringText prepended to log messages