# Tool: Using Splunk to analyse MikroTik logs 3.3 (Graphing everything) 💾 🛠 💻 📊

**URL:** <https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810>\
**Category:** Useful user articles\
**Created:** [July 27, 2018, 8:23am UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810 "2018-07-27T08:23:03Z")\
**Posts on this page:** 20\
**Page:** 22

<div class="post-metadata">

**Author:** ![David1234](https://forum.mikrotik.com/letter_avatar/david1234/32/6_449c533f586939b6e5f246632a46421f.png) [@David1234](https://forum.mikrotik.com/u/David1234)\
**Post date:** [June 16, 2021, 1:16pm UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/421 "2021-06-16T13:16:57Z")

</div>

great guide  
I need some first time help

I have done “almost” everything you said

this is what I have done in the login

```plaintext
/system logging action
set 3 remote=192.168.1.0
/system logging
add action=remote prefix=MikroTik topics=account
add action=remote prefix=MikroTik topics=critical

```

for now I want to see all the login attempts made to my router

I can see in the “MikroTik Admin user login” all the login (good and bad)  
so I guess this working , now? right

I have also added the script - but I can’t see any data on router voltage\temp  
the script in running without any problems - so why I don’t see in the the Splunk?

I can’t see any other data also in no page - everything is No results found. (even on router uptime, temp\voltage )  
why is it?  
the accounting is working

```plaintext
/ip accounting
set enabled=yes threshold=2560

```

do I need to enable something in the firewall so the server can read this data or something ?  
\*\*also why do I need to enable the accounting? , the data is send out from the router and not from the Splunk to the router - or I missunderstand soemthing?  
Thanks ,

---

<div class="post-metadata">

**Author:** ![Jotne](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/jotne/32/56097_2.png) [@Jotne](https://forum.mikrotik.com/u/Jotne)\
**Post date:** [June 16, 2021, 2:48pm UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/422 "2021-06-16T14:48:13Z")

</div>

Remember with this:

```plaintext
add action=remote prefix=MikroTik topics=account
add action=remote prefix=MikroTik topics=critical

```

You only get all **account** and **critical** logs and nothing else from the internal logs.

That is what I do use:

```plaintext
/system logging add action=logserver prefix=MikroTik topics=dhcp
/system logging add action=logserver prefix=MikroTik topics=!debug,!packet,!snmp
/system logging add action=logserver prefix=MikroTik topics=hotspot

```

This gets all **dhcp** logs including debug dhcp packets.  
This gets all **hotspot** logs including debug hotspot packets.  
With the **!** , get all other logs that are not **debug** , **packet** and **snmp**.

Voltage and temperature are only on devices that do supports it.  
Accounting is used to get all the packet flow from the router to Splunk.  
Accounting is gone in v7, so there netflow has to be used. Not implemented in my solution, yet.

---

<div class="post-metadata">

**Author:** ![David1234](https://forum.mikrotik.com/letter_avatar/david1234/32/6_449c533f586939b6e5f246632a46421f.png) [@David1234](https://forum.mikrotik.com/u/David1234)\
**Post date:** [June 16, 2021, 3:02pm UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/423 "2021-06-16T15:02:08Z")

</div>

OK  
I just saw you answer  
I thought that on the RBM33G there is temp\voltage , but now I see there isn’t any

```plaintext
 :put [/system health get cpu-temperature]

```

I can see the device now , I looked somewhere else

so if I want to see only spesific things I can only make logs for them ?  
is there any where a WiKi or some explain about what each page can show and how he read it ?  
for example -  
this is what I get in the Device list

```plaintext
18.14.45.136	Test_Router	A2FFFFF71F31	RBM33G	RBM33G	6.48.2 (stable)	1

```

is there any way to change the first IP to some local variable to be sent?

---

<div class="post-metadata">

**Author:** ![Jotne](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/jotne/32/56097_2.png) [@Jotne](https://forum.mikrotik.com/u/Jotne)\
**Post date:** [June 16, 2021, 4:51pm UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/424 "2021-06-16T16:51:14Z")

</div>

You can send anything to logs, in for example this form.

```plaintext
:log info message="This is a test"

```

Then in splunk you should be able to see this by search for:

```plaintext
"This is a test"

```

---

<div class="post-metadata">

**Author:** ![David1234](https://forum.mikrotik.com/letter_avatar/david1234/32/6_449c533f586939b6e5f246632a46421f.png) [@David1234](https://forum.mikrotik.com/u/David1234)\
**Post date:** [June 17, 2021, 11:59am UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/425 "2021-06-17T11:59:42Z")

</div>

great  
I will try to see now what can I do with this

thank you !

\*\*\* I will ask if I will have more questions

---

<div class="post-metadata">

**Author:** ![David1234](https://forum.mikrotik.com/letter_avatar/david1234/32/6_449c533f586939b6e5f246632a46421f.png) [@David1234](https://forum.mikrotik.com/u/David1234)\
**Post date:** [June 20, 2021, 10:16am UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/426 "2021-06-20T10:16:47Z")

</div>

more quetsions:  
for my testing I only want to be able to see the MikroTik Admin user login block\OK  
I have setup a loggin like this:

```plaintext
/system logging action
add name=Splunk remote=12.15.15.14 target=remote
/system logging
add disabled=yes topics=ovpn,debug
add action=DavidServer disabled=yes topics=warning
add action=Splunk prefix=MikroTik topics=account
add action=Splunk prefix=MikroTik topics=critical

```

when I put a wrong password I can see in the router logs “error login failure for user admin from 8.19.166.6 via winbox”  
and on the splunk page I can see the line:

```plaintext
_time	host	user	system	user_ip	eventtype	host_name
2021-06-20 12:56:50	9.13.10.118	admin	winbox 8.19.166.6	adm_user_login_failure	9.13.10.118

```

2 questions (help)  
why I can’t see the name I setup in the identity for this router in the host name \ host user system?

is there any way to make the login send more information ? for example the MAC of the ethernet and put it in the host name?  
I’m asing because my devices use dynamic IP - so the router IP give me nothing.

Thanks ,

---

<div class="post-metadata">

**Author:** ![Jotne](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/jotne/32/56097_2.png) [@Jotne](https://forum.mikrotik.com/u/Jotne)\
**Post date:** [June 20, 2021, 8:38pm UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/427 "2021-06-20T20:38:49Z")

</div>

Everything is already logged in menu **Overview** → **MikroTik Admin user login**.  
There you see both logged inn and blocked user.

You have changed from the default log action setup and do loose a lot of information since you do only log some.  
Change back to what is posted inn first post and you get all back.

This one logs all except: **!debug,!packet,!snmp**

```plaintext
/system logging add action=logserver prefix=MikroTik topics=!debug,!packet,!snmp

```

---

<div class="post-metadata">

**Author:** ![nikc](https://forum.mikrotik.com/letter_avatar/nikc/32/6_449c533f586939b6e5f246632a46421f.png) [@nikc](https://forum.mikrotik.com/u/nikc)\
**Post date:** [June 29, 2021, 9:13am UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/428 "2021-06-29T09:13:31Z")

</div>

1st up, amazing effort, love this, so easy to setup and use, thank you.

I have a question though …

A lot of my nodes are LTE based devices, so they tend to change IP address quite frequently and as a result of that if i want to look at traffic utlisiation for the device, i need to collate all the stats from the various IPs.

Is there any way to aggregate the data at hostname level opposed to IP ?

Thanks

---

<div class="post-metadata">

**Author:** ![Jotne](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/jotne/32/56097_2.png) [@Jotne](https://forum.mikrotik.com/u/Jotne)\
**Post date:** [June 29, 2021, 3:58pm UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/429 "2021-06-29T15:58:06Z")

</div>

The app do use IP as hostname and do sort everything after that, so when IP changes, it will see it as a new device.

What can be done is to tag all packed with an id so that all router can be identified even after IP change.

Example, change from:

```plaintext
/system logging add action=logserver prefix=MikroTik topics=dhcp
/system logging add action=logserver prefix=MikroTik topics=!debug,!packet,!snmp
/system logging add action=logserver prefix=MikroTik topics=hotspot

```

To:

```plaintext
add action=logserver prefix="MikroTik: sys=22" topics=dhcp
add action=logserver prefix="MikroTik: sys=22" topics=!debug,!packet
add action=logserver prefix="MikroTik: sys=22" topics=hotspot

```

Use different number or name for the **sys** to distinguish each ruter.  
Take care not use to long ID, since it eats of the max packet size.

Then you need to adapt the Splunk app to use **sys** instead of **host**  
Its some work to do, but it will give you separate logs for each router based by the sys name.

---

<div class="post-metadata">

**Author:** ![David1234](https://forum.mikrotik.com/letter_avatar/david1234/32/6_449c533f586939b6e5f246632a46421f.png) [@David1234](https://forum.mikrotik.com/u/David1234)\
**Post date:** [July 5, 2021, 6:50am UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/430 "2021-07-05T06:50:48Z")

</div>

another question  
I notice that my all my device are sending data to another syslog system  
so I have connected to the log file of it and sendting the data to the Splunk  
it’s working - I get the data - but not as mikrotik (just as regular udp syslog )  
is there anything I can change in the setting of the Splunk-Mikrotik to read that data?

this is what I’m getting on the splunk :

```plaintext
SEVERE 05/07 06:24:06 wrong message: 3.13.12.118 <27>Jul 5 09:24:06 Router script error: error - contact MikroTik support and send a supout file (2)

```

can I change the reading somehow so it will enter the splunk as Mikrotik ?

Thanks ,

---

<div class="post-metadata">

**Author:** ![Jotne](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/jotne/32/56097_2.png) [@Jotne](https://forum.mikrotik.com/u/Jotne)\
**Post date:** [July 5, 2021, 11:01am UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/431 "2021-07-05T11:01:44Z")

</div>

If I understand you, you do not get the “ **MikroTik** ” prefix?

> system,info,account \> **MikroTik** \> : sys=22: user hidden logged out from 1.2.3.4 via winbox

The whole app with field extraction etc are based on this tag, so If that changes or are removed, lots of the stuff inn the app must be rewritten.  
Possible, but you need to try to figure it out.

---

<div class="post-metadata">

**Author:** ![eb123456](https://forum.mikrotik.com/letter_avatar/eb123456/32/6_449c533f586939b6e5f246632a46421f.png) [@eb123456](https://forum.mikrotik.com/u/eb123456)\
**Post date:** [July 28, 2021, 4:32am UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/432 "2021-07-28T04:32:28Z")

</div>

Thank you so much Jotne this is an amazing tool you put together!  
I am new to Mikrotik, just got the router 2 weeks ago.  
I am wondering how you guys get the hostname to show in the screenshots? I have the IP address instead?

![](https://ibb.co/c21dXLv)

---

<div class="post-metadata">

**Author:** ![jvanhambelgium](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/jvanhambelgium/32/1676_2.png) [@jvanhambelgium](https://forum.mikrotik.com/u/jvanhambelgium)\
**Post date:** [July 28, 2021, 11:54am UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/433 "2021-07-28T11:54:17Z")

</div>

> [@](#):
>
> Thank you so much Jotne this is an amazing tool you put together!  
> I am new to Mikrotik, just got the router 2 weeks ago.  
> I am wondering how you guys get the hostname to show in the screenshots? I have the IP address instead?
> 
> ![](https://ibb.co/c21dXLv)

My Splunk host (=VM) just resolves these.  
If you have a rather “static” small home-network, just add them to /etc/hosts or something on the Splunk host so your internal entries are resolved too.  
If you run a Pihole or other DNS internal just let Splunk use that one and add the entries over there.

---

<div class="post-metadata">

**Author:** ![Jotne](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/jotne/32/56097_2.png) [@Jotne](https://forum.mikrotik.com/u/Jotne)\
**Post date:** [July 28, 2021, 3:34pm UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/434 "2021-07-28T15:34:50Z")

</div>

> [@](#):
>
> I am wondering how you guys get the hostname to show in the screenshots? I have the IP address instead?

Some scripts run only once every day, so if you wait one day, it should be ok.

PS post image on the forum using Attachements below the post instead of posting a link.

---

<div class="post-metadata">

**Author:** ![eb123456](https://forum.mikrotik.com/letter_avatar/eb123456/32/6_449c533f586939b6e5f246632a46421f.png) [@eb123456](https://forum.mikrotik.com/u/eb123456)\
**Post date:** [July 29, 2021, 2:56am UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/435 "2021-07-29T02:56:33Z")

</div>

Thank you editing the /etc/hosts does provide immediate name resolution.

I need to do some digging though: on the splunk host I seem to be experiencing local DNS issues:

me@docker01:~/scripts$ host 192.168.88.24  
Host 24.88.168.192.in-addr.arpa. not found: 3(NXDOMAIN)  
me@docker01:~/scripts$ ping DESKTOP-MESF01  
ping: DESKTOP-MESF01: Temporary failure in name resolution  
me@docker01:~/scripts$ ping DESKTOP-MESF01.local  
PING DESKTOP-MESF01.local (192.168.88.24) 56(84) bytes of data.

---

<div class="post-metadata">

**Author:** ![jvanhambelgium](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/jvanhambelgium/32/1676_2.png) [@jvanhambelgium](https://forum.mikrotik.com/u/jvanhambelgium)\
**Post date:** [July 29, 2021, 5:35am UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/436 "2021-07-29T05:35:36Z")

</div>

Ah ok, you run Splunk in a container.  
DNS resolving in a container is slightly different so I read. Perhaps you could try info below ?  
On linux systems, DNS resolution happens using /etc/resolv.conf file, check this file inside your container, if it has invalid DNS, then your container won’t be able to resolve hostnames.

Docker uses a property set in /etc/docker/daemon.json file(on host) for populating entries in /etc/resolv.conf inside container.  
update the value of this property in /etc/docker/daemon.json file in host machine:

{  
“dns”: [“8.8.8.8”]  
}  
Note: This change requires restarting docker to take effect, also existing containers have to be removed and created again.

Restarting Docker:

sudo systemctl restart docker  
removing containers:

sudo docker stop \<container-name/id\>  
sudo docker rm \<container-name/id\>

---

<div class="post-metadata">

**Author:** ![eb123456](https://forum.mikrotik.com/letter_avatar/eb123456/32/6_449c533f586939b6e5f246632a46421f.png) [@eb123456](https://forum.mikrotik.com/u/eb123456)\
**Post date:** [July 29, 2021, 10:33pm UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/437 "2021-07-29T22:33:01Z")

</div>

oh I should have mentioned that the command line output I shared were directly from the docker host that runs the docker container. The DNS issues materialize on the physical machine and for some reasons name resolution only happen with the .local domain.

Anyway - I did not figure it out yet, but I am happy with the /etc/hosts solution. I actually find it better than DNS resolution because I can give more friendly name to my devices.

For those who are contemplating running splunk in docker, here is my script:

```plaintext
docker stop splunk-server 
docker rm splunk-server 
docker run -d \
-p 8000:8000 \
--name splunk-server \
-v /data/syslog/udp:/data/syslog/udp \
-v /data/syslog/tcp:/data/syslog/tcp \
-v /data/splunk/etc:/opt/splunk/etc \
-v /data/splunk/var:/opt/splunk/var \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/hosts:/etc/hosts:ro \
-v ~/conf/input.conf:${SPLUNK_HOME}/etc/apps/MikroTik/default/input.conf \
-e SPLUNK_START_ARGS='--accept-license' \
-e SPLUNK_PASSWORD='XXXXXXXXXXX' \
--restart always \
splunk/splunk:latest

```

---

<div class="post-metadata">

**Author:** ![Jotne](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/jotne/32/56097_2.png) [@Jotne](https://forum.mikrotik.com/u/Jotne)\
**Post date:** [August 13, 2021, 5:18am UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/438 "2021-08-13T05:18:58Z")

</div>

# Script version 4.4

# 4.4 Removed on-error from wifi

# 4.4 Removed on-error from board info

Some small changes to error handling, no need for upgrade.

---

<div class="post-metadata">

**Author:** ![Jotne](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/jotne/32/56097_2.png) [@Jotne](https://forum.mikrotik.com/u/Jotne)\
**Post date:** [August 13, 2021, 9:17am UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/439 "2021-08-13T09:17:22Z")

</div>

Splunk for MikroTik updated to v3.3

New file found under section **1g)** at the first post

This version contains lots of tweaks and fixes, and some new KV store

To upgrade, delete the folder /splunk/etc/app/Mikrotik  
Then install the unpacked spl (use winrar/winzip) file, install app from  
"Manage app" -\> "Install app from file"

To get the most out of this version, upgrade the script (not needed) on the router to latest version. (3.9+)

# 3.3 (13.08.2021)

# New KV store (used to store info about Devices and DHCP info

# Changed from table to fields in base search for all dashboard to speed up searches.

# Added more DNS extraction

# Updated script to 4.4 (Added firmware info)

# Added frimware info "MikroTik Device List"

# Fixed lookup "MikroTik Wifi strength"

# Added new DoH dashboard "MikroTik DoH information"

# Change table format "MikroTik Interface Changes"

# Fixed typo in eventtype "MikroTik VPN Connections"

# Added user local ip "MikroTik VPN Connections"

# Fixed missing search in 2b, duplicate entry in user-name, added 1b login info "MikroTik VPN Connections"

# Fixed to not show false logged in user "MikroTik VPN Connections"

# Fixed html formatting in "Mikrotik DHCP to Static"

# Fixed missing City in "Mikrotik Firewall Rules"

# Moved "Mikrotik uPnP" to Connections menu

# Added table view to "Mikrotik uPnP"

---

<div class="post-metadata">

**Author:** ![jvanhambelgium](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/jvanhambelgium/32/1676_2.png) [@jvanhambelgium](https://forum.mikrotik.com/u/jvanhambelgium)\
**Post date:** [August 13, 2021, 10:41am UTC](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/440 "2021-08-13T10:41:55Z")

</div>

Thanks for the update Jotne.  
**I seems I've lost data on the "Overview" \> "Device List" is not populating (as in "no result found")**  
All other tabs seems to work find, data is still coming in normally.  
I'm running it on a RB3011 / 6.47.x release

If I look in the output on the console while the script is running, I'm only seeing this line : " **script=version ver=4.4**" where I normally would need to see more like

:log info message="s\*\*cript=sysinfo version="$version\*\*" board-name="$board" model="$model" serial=$serial identity="$identity" factory-firmware="$ffirmware" current-firmware="$cfirmware" upgrade-firmware="$ufirmware""  
  
  
  
The previous script had this section

# Collect system information

# ----------------------------------

:local model  
:local serial  
if ($SystemInformation and $run) do={  
:local version ([/system resource get version])  
:local board ([/system resource get board-name])  
:do {  
:set model ([/system routerboard get model])  
:set serial ([/system routerboard get serial-number])  
} on-error={  
:set model na  
:set serial na  
}  
:local identity ([/system identity get name])  
:log info message="script=sysinfo version="$version" board-name="$board" model="$model" serial=$serial identity="$identity""  
}

While you new script has this one  
  
\

# Collect system information

# ----------------------------------

:local model na  
:local serial na  
:local ffirmware na  
:local cfirmware na  
:local ufirmware na  
:if ($SystemInformation and $run) do={  
:local version ([/system resource get version])  
:local board ([/system resource get board-name])  
:if ([/system routerboard get routerboard]) do={  
/system routerboard  
:set model ([get model])  
:set serial ([get serial-number])  
:set ffirmware ([get factory-firmware])  
:set cfirmware ([get current-firmware])  
:set ufirmware ([get upgrade-firmware])  
}  
:local identity ([/system identity get name])  
:log info message="script=sysinfo version="$version" board-name="$board" model="$model" serial=$serial identity="$identity" factory-firmware="$ffirmware" current-firmware="$cfirmware" upgrade-firmware="$ufirmware""  
}

[Previous page](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810.md?page=21)

[Next page](https://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810.md?page=23)
