UTMStack

Articles13 min read

MikroTik SIEM Integration: Forward RouterOS Logs and Detect

By UTMStack Team

UTMStack blog: MikroTik logs to SIEM

MikroTik routers sit at the edge of hundreds of thousands of networks, and attackers have turned them into botnets and hidden relays more than once. A hijacked router rarely looks broken. It keeps passing traffic while someone else uses it. By default, RouterOS keeps its log in memory and loses it at every reboot, so the evidence often disappears before anyone looks. This guide shows how to send MikroTik logs to a SIEM (security information and event management system), which entries matter, and what to alert on.

The short answer: Point the router’s remote logging action at your SIEM and add one logging rule per topic: /system/logging/action/set remote remote=<siem-address> remote-log-format=syslog, then /system/logging/add topics=info action=remote, and the same for warning, error and critical. Do not put several topics in one rule, because a rule only matches entries that carry all of them. RouterOS sends over UDP (User Datagram Protocol) port 514 by default. From RouterOS 7.18 you can send CEF (Common Event Format) over TCP (Transmission Control Protocol) or encrypted TLS (Transport Layer Security). Then alert on failed logins, new users, proxy, script, scheduler, DNS (Domain Name System) and firewall changes.

Why MikroTik routers are a target

The same weaknesses come up in every public case: management ports open to the internet, old RouterOS versions and passwords that were never changed. The attacks that followed shaped what defenders now watch for.

Attacks on MikroTik routers, 2018 to 2025

Public reports from MikroTik, the US National Vulnerability Database and security research teams

  1. 2018Winbox flawCVE-2018-14847 lets anyone read files, passwords included, on RouterOS up to 6.42
  2. Sep 2021Meris botnetQrator and Yandex record 21.8 million requests per second and estimate more than 200,000 devices
  3. Mar 2022Trickbot relaysMicrosoft: routers forward port 449 to hide the malware's control servers
  4. Jul 2023Admin to super-adminCVE-2023-30799 affects stable versions before 6.49.7
  5. Jan 2025Mail relay botnetInfoblox: about 13,000 routers turned into open SOCKS proxies by a script
SOCKS is a general-purpose proxy protocol. In each case the routers kept working normally for their owners while attackers used them.

The details matter for detection. The US National Vulnerability Database rates CVE-2018-14847 at 9.1 out of 10, and the US Cybersecurity and Infrastructure Security Agency (CISA) lists it among flaws known to be exploited. MikroTik said the Meris botnet used no new flaw: the routers were ones compromised back in 2018 whose passwords were never changed afterwards. During the largest Meris attack, Qrator and Yandex saw 56,000 attacking hosts at once.

What attackers changed on the routers is the useful part. MikroTik’s own Meris statement tells owners to look for scheduler rules that run a fetch script, an enabled SOCKS proxy, an unknown Layer 2 Tunneling Protocol (L2TP) client, a firewall rule that opens port 5678 and scripts they did not create. Microsoft found network address translation rules that redirect port 449 to port 80, changed passwords and new users. Every one of these changes writes a log entry. The entry only helps if it leaves the router.

What RouterOS logs by default

Out of the box, a MikroTik router logs to itself and nowhere else.

  • Memory only. Entries with the topics info, error and warning go to memory. Entries marked critical are printed on the console.
  • 1,000 entries. The memory log keeps the newest 1,000 entries. On a busy router that can be less than a day.
  • Gone at reboot. The memory log does not survive a restart. An attacker who reboots the router, or an owner who restarts it to “fix” odd behavior, erases the trail.
  • No remote copy. A remote action exists, but it has no server address and no rule uses it.

MikroTik’s manual gives the fix in one line: to keep the log, write it to a disk or send it to a syslog server. For security work, a remote server is the better choice, because an intruder with administrator rights on the router can clear local files too.

How to forward MikroTik logs to a SIEM

These steps follow MikroTik’s RouterOS 7 manual. Run them in the terminal, in Winbox (System, then Logging) or in the web interface.

1. Point the remote action at your SIEM.

/system/logging/action/set remote remote=192.0.2.10 remote-log-format=syslog

Replace the address with your SIEM or log collector. Add remote-port= if it does not listen on 514.

2. Add one rule per topic.

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

This is the step that most guides get wrong. A rule with topics=info,warning,error does not mean “any of these”. It matches only entries that carry all three topics, which is none. Use separate rules. Also note that topics=account covers logins and logouts only. Failed logins carry system,error,critical, so they arrive through the error or critical rule.

3. Choose the format.

FormatWhat the SIEM receivesWhen to use it
defaultThe topics and the message, with no time and no host nameRarely useful for a SIEM
syslogBSD syslog (RFC 3164): priority, time, router identity, messageOver UDP, for any syslog receiver
cefCommon Event Format with fields such as user, service and source addressRouterOS 7.18 or later, and always over TCP or TLS

In the syslog format the topics are not sent. Set add-topics-string=yes on the action so the SIEM can tell a firewall entry from a login entry. The BSD time has no year and no time zone, so set syslog-time-format=iso8601 if the router and the SIEM are in different time zones, and keep the router’s clock right with the Network Time Protocol (NTP).

One failed login, three formats

The same RouterOS entry as the SIEM receives it, from the examples in MikroTik's manual

defaultTopics and message onlysystem,error,critical login failure for user guest from 192.168.88.17 via ssh
syslogTime and router name, no topics<27>Oct 2 17:36:35 MikroTik login failure for user guest from 192.168.88.17 via ssh
cefNamed fields a SIEM can read directly...|system,error,critical|High|dvchost=MikroTik msg=login failure for user guest from 192.168.88.17 via ssh app=ssh duser=guest outcome=failure src=192.168.88.17
The CEF line is shortened here. Its header also carries the board name and the RouterOS version, which helps you find routers that need an update.

4. Prefer TCP or TLS where you can. Over UDP, entries are lost while the SIEM is unreachable. Over TCP or TLS, the router holds up to 1,000 entries in memory while the connection is down and sends them when it returns. MikroTik’s manual says to use the CEF format over TCP and TLS, because the other formats have no separator between entries and most receivers cannot split them. A TLS setup looks like this:

/system/logging/action/add name=siem target=remote remote=192.0.2.10 remote-port=6514 remote-protocol=tls remote-log-format=cef check-certificate=yes
/system/logging/add topics=info action=siem
/system/logging/add topics=warning action=siem
/system/logging/add topics=error action=siem
/system/logging/add topics=critical action=siem

Import the certificate of the authority that signed the SIEM’s certificate first. Without check-certificate=yes, the router encrypts the connection but accepts any certificate.

5. Log the firewall rules that matter. RouterOS does not log packets unless a rule asks for it. Add log=yes and a log-prefix to the rules you care about. MikroTik’s manual uses the rule that drops invalid connections as its example:

/ip/firewall/filter/add action=drop chain=forward connection-state=invalid log=yes log-prefix=invalid

Do the same for the rule that drops traffic to the router’s own management ports.

A logged packet shows the incoming and outgoing interface, the source hardware address, the protocol, the source and destination with ports, and the length. Do not log every accepted connection on a busy router. It floods the SIEM and loads the router for little gain.

6. Test it.

/log/warning "syslog test"

Search your SIEM for the test message. If nothing arrives, MikroTik’s troubleshooting table lists the usual causes: the action still has remote=0.0.0.0, a rule lists several topics, or the receiver does not accept the protocol and port.

Which topics to send

RouterOS tags every entry with one or more topics. These are the ones a SIEM needs for security work.

TopicWhat it carriesSecurity use
critical and errorLogin failures, watchdog reboots, clock correctionsPassword guessing against Winbox, SSH (Secure Shell) or the web interface
accountLogins and logouts with user, address and serviceWho managed the router, and from where
system with infoConfiguration changes with the user who made themNew users, scripts, schedulers, proxy and DNS changes
firewallPackets matched by rules with logging onScans and connection attempts against management ports
warningUnusual conditionsContext for failures and misuse
dhcp, wireless, ipsec, l2tp, ovpn, wireguardAddress leases, wireless clients, tunnel sessionsWhich device had an address, and who connected remotely
scriptOutput and errors of scriptsScripts that run when nobody scheduled them

The four rules in step 2 already cover the first five rows, because those entries also carry info, warning, error or critical. Add rules for firewall and the tunnel topics only if you turn that logging on.

What to detect on a MikroTik router

The detections below follow the order of a typical router takeover. The example messages come from MikroTik’s manual and from logs that owners of compromised routers posted on MikroTik’s forum.

MikroTik detections along the attack path

What to alert on at each stage, and whether UTMStack ships a rule for it

Built-in UTMStack ruleWrite your own rule
  1. Get inReach the management ports
    Burst of failed loginslogin failureRepeated connections to SSHport 22Login from an unknown addresslogged in from
  2. StayKeep access
    User added or group changeduserNew script or schedulernew scriptUnknown tunnel clientl2tp
  3. UseTurn the router into a tool
    SOCKS proxy changedsocksStatic DNS entry changeddnsFlood of DNS responsesdnsPort redirect addednat rule
  4. HideBlind the owner
    Firewall rule changedfilter ruleRouter stops sending logsno events
Six built-in rules and six that you write yourself. The first stage is the cheapest place to stop an attack.
DetectionWhat to look for
Burst of failed loginsMany login failure for user ... from ... via ssh (or winbox, web) entries from one address in a few minutes
Login from an unknown addressuser admin logged in from <address> via winbox where the address is outside your management network
New user or group changeA system,info entry about a user being added or moved to another group
SOCKS proxy enabledsocks config changed by admin or socks acl entry added by admin on a router that never used the proxy
New script or schedulernew script added by admin and new script scheduled by admin
DNS changesstatic dns entry added by ..., which can send users to a fake site
Port redirectA new network address translation rule, such as the port 449 redirect Microsoft described
Firewall rule changedfilter rule changed by admin, especially a rule that opens a management port to the internet
Router went silentA router that normally sends logs stops for longer than its usual gap

Two notes on tuning. First, configuration changes are normal on the day an administrator works on the router, so pair each alert with the user and source address, and treat changes from outside the management network as urgent. Second, a silent router is a warning sign in itself. Attackers can remove the logging rule as easily as you added it.

For how rules like these are written and tuned, see SIEM correlation rules. For the basics of the protocol and the UDP and TCP trade-off, see what syslogs are. The same approach for hypervisors is in our guide to sending ESXi logs to a SIEM.

Hardening that makes the logs useful

Logs work best on a router that limits how attackers get in. These points come from MikroTik’s “Securing your router” guide. They also cut noise, because every remaining login attempt becomes worth a look.

  • Update RouterOS. The 2018 and 2023 flaws are fixed in current versions. A router on an old version stays exposed no matter what you log.
  • Replace the default admin user with a named account and a strong password.
  • Keep management off the internet. Reach the router through a virtual private network such as WireGuard, and limit each service to your management network, for example /ip/service/set winbox available-from=192.168.88.0/24.
  • Turn off services you do not use: /ip/service/disable telnet,ftp,www,api.
  • Turn off the SOCKS proxy with /ip/socks/set enabled=no, and the web proxy and Universal Plug and Play if unused.
  • Close the side doors: /tool/mac-server/set allowed-interface-list=none and /ip/neighbor/discovery-settings/set discover-interface-list=none.
  • Use strong SSH settings: /ip/ssh/set strong-crypto=yes.

How UTMStack handles MikroTik logs

We build UTMStack, so weigh our view accordingly. Here is how it works with MikroTik, including what it does not do.

  • Collection without an agent. The UTMStack Collector is a small Linux service that runs on the UTMStack server or another Linux host in your network. It listens for MikroTik syslog on port 7007 over UDP or TCP, and over TLS once you load a certificate. Nothing is installed on the router. See integrations.
  • Parsing. A dedicated parser reads BSD syslog lines from RouterOS. It pulls out the topics, the firewall chain, the protocol, source and destination addresses with ports, and the source hardware address. It adds the country of each address and marks dropped packets as blocked.
  • Six built-in MikroTik rules. They cover repeated login failures (10 in 15 minutes from one address), repeated SSH connections to the router (10 in 15 minutes), new users and group changes, SOCKS proxy changes, static DNS entry changes, and bursts of DNS responses that suggest cache poisoning. Each maps to MITRE ATT&CK and is checked as each log arrives, before storage, alongside the rest of the 600+ detection rules.
  • Context from other sources. The same instance can hold your Windows, Linux, firewall and cloud logs, so a router login can be read next to what the same address did elsewhere.
  • Free to start. Syslog integrations, MikroTik included, are part of the free Community edition, which installs on your own Linux server.

What it does not do:

  • No response on the router itself. UTMStack response flows run through agents on Windows, Linux and macOS. RouterOS has no agent, so disabling a user or closing a port on the router is a manual step.
  • No built-in rule for new scripts, schedulers, port redirects, unknown tunnel clients or firewall rule changes. Those are the changes MikroTik and Microsoft tell owners to check after an attack. Add custom rules that match the messages in the table above.
  • The parser expects the BSD syslog layout with the topics in the line. Set add-topics-string=yes, send a test login failure, and confirm in the log explorer that the topics and addresses land in their own fields before you rely on the rules. RouterOS 7.18 changed the remote format options, and the CEF format is not what this parser was written for. You can adjust the pipeline in the interface if your version sends a different layout.
  • The Collector does not store logs. It passes each entry on as it arrives. Entries that arrive while the UTMStack server is unreachable are lost, so keep the Collector close to the server or on it.

UTMStack is priced per device, never by log volume, and each router counts as one device. Ask for a quote or see pricing.

Frequently asked questions

Which port does MikroTik use for syslog? UDP port 514 by default. You can change it with remote-port on the logging action. For TLS, MikroTik’s example uses port 6514.

Does MikroTik support syslog over TCP or TLS? Yes, in current RouterOS 7. Set remote-protocol=tcp or tls on the action. MikroTik’s manual says to pair them with the CEF format, which was added in RouterOS 7.18, because the other formats do not mark where one entry ends.

Why does my SIEM receive nothing from the router? The three usual causes are a remote action that still points to 0.0.0.0, a logging rule that lists several topics at once, and a firewall between the router and the SIEM. Send a test entry with /log/warning "syslog test" after each change.

Does a MikroTik router keep its logs after a reboot? Not by default. The memory log holds the newest 1,000 entries and is lost at restart. Log to a disk or to a remote server to keep them.

Can I install a SIEM agent on RouterOS? No. RouterOS does not run ordinary Windows or Linux agents. Remote logging is the supported way to get its logs out.

Is NetFlow from MikroTik enough for a SIEM? No. RouterOS can export traffic flow records, which show who talked to whom. They do not show logins or configuration changes. Send both if you can, and send the log first.

Sources