Skip to content

Syslog with Elasticsearch

Configuration Guidemd-a5kj5
DateFebruary 13, 2026
RouterOS Version7.x
Elasticsearch Version8.x

Elasticsearch is a powerful NoSQL database that can store and analyze log data from RouterOS devices. Combined with Kibana, it provides a comprehensive solution for centralized logging, searching, and visualization of MikroTik router logs.

This guide covers setting up syslog collection from RouterOS devices to Elasticsearch using the syslog protocol (RFC 5424).


  • RouterOS v7.x device
  • Elasticsearch 8.x installed (single node or cluster)
  • Kibana 8.x for visualization
  • Network connectivity between RouterOS and Elasticsearch on syslog port (UDP/TCP 514)

In Elasticsearch 8.x, you need to enable the syslog input in elasticsearch.yml:

/etc/elasticsearch/elasticsearch.yml
xpack.security.enabled: true
xpack.security.authc.api_key.enabled: true
# Syslog input (UDP)
ingest.geoip.downloader.enabled: false

Create an ingest pipeline for syslog parsing:

Terminal window
# Create syslog ingest pipeline
PUT _ingest/pipeline/syslog
{
"description": "Parse RouterOS syslog messages",
"processors": [
{
"grok": {
"field": "message",
"patterns": [
"%{SYSLOGTIMESTAMP:timestamp} %{HOSTNAME:host} %{DATA:program}: %{GREEDYDATA:message}"
]
}
},
{
"date": {
"field": "timestamp",
"formats": ["MMM dd HH:mm:ss"]
}
}
]
}
Terminal window
# Create index template for RouterOS logs
PUT _index_template/routeros-syslog
{
"index_patterns": ["routeros-logs-*"],
"template": {
"mappings": {
"properties": {
"timestamp": {"type": "date"},
"host": {"type": "keyword"},
"program": {"type": "keyword"},
"message": {"type": "text"},
"topic": {"type": "keyword"},
"router": {"type": "keyword"}
}
}
}
}
Section titled “4. Configure Filebeat (Recommended Alternative)”

Instead of direct syslog ingestion, use Filebeat:

/etc/filebeat/filebeat.yml
filebeat.inputs:
- type: syslog
protocol.udp:
host: "0.0.0.0:514"
protocol.tcp:
host: "0.0.0.0:514"
output.elasticsearch:
hosts: ["localhost:9200"]
index: "routeros-logs-%{[agent.version]}"

Enable the syslog module:

Terminal window
filebeat modules enable syslog
# Create syslog action pointing to Elasticsearch server
/system logging action
add name="elastic" remote=10.0.0.100 remote-port=514 \
syslog-facility=local0 syslog-severity=informative \
target=remote
# Add logging rules for topics you want to send to Elasticsearch
/system logging
add action=elastic topics=info
add action=elastic topics=warning
add action=elastic topics=error
add action=elastic topics=critical
add action=elastic topics=system
add action=elastic topics=firewall
add action=elastic topics=accounting
# Check logging configuration
/system logging print
# Test syslog UDP port connectivity
/ping 10.0.0.100 protocol=udp port=514 count=3

Open Kibana in your browser and navigate to Discover or create a new index pattern.

  1. Go to Stack ManagementIndex Patterns
  2. Create index pattern: routeros-logs-*
  3. Set @timestamp or timestamp as the time field
program:firewall AND message:drop
program:dhcp
topic:error
Panel TypeDescriptionQuery
Firewall DropsShow dropped packetsprogram:firewall AND message:drop
Error CountTrack errors over timetopic:error
System EventsRouter system messagestopic:system
Bandwidth AlertsTraffic threshold warningsprogram:traffic

Terminal window
# Verify logs are being received
curl -XGET 'localhost:9200/routeros-logs-*/_search?pretty&q=*'
# Check index exists
curl -XGET 'localhost:9200/_cat/indices/routeros-logs-*'
# Check if syslog is being sent
/system logging print
# View local logs
/log print
# Enable debug logging temporarily
/system logging add topics=debug action=elastic
IssueSolution
No logs in ElasticsearchCheck firewall allows UDP/TCP 514
Index not createdVerify Filebeat/ingest pipeline is running
Missing timestampsCheck date processor in ingest pipeline
High memory usageReduce number of logging topics or use filtering
# Test syslog TCP port connectivity
/tool telnet 10.0.0.100 514
# Capture packets to verify sending
/tool sniffer start interface=ether1 port=514
/tool/sniffer/packet/print

  1. Enable TLS - Use syslog over TLS (RFC 5425) for encrypted transmission
  2. Firewall Rules - Restrict syslog port to only your Elasticsearch server
  3. Authentication - Consider using API keys for Filebeat authentication
  4. Rate Limiting - Configure appropriate logging levels to avoid log flooding