Skip to main content

Syslog Is Not Dead: Visualizing Nokia SR OS Logs in Grafana with Loki and Alloy

Nokia SR OS, syslog, Grafana, Loki, Grafana Alloy, Containerlab

Updated 9 min readMarkdown
Syslog Is Not Dead: Visualizing Nokia SR OS Logs in Grafana with Loki and Alloy

Every router already tells you what is happening. BGP sessions drop, ISIS adjacencies flap, and someone commits a change late at night. The information is there, in the router's event log. The trouble is where it lives.

You SSH in, run show log log-id, and scroll through a finite buffer, one router at a time. When something breaks across several routers, you end up juggling terminals and lining up timestamps by eye.

This article shows how to send SR OS syslog into Grafana using Loki and Grafana Alloy. It covers why the effort is worth it and how the pieces fit together

Why put syslog into Grafana

  • One place for every router: You do not need to log into every router to diagnose an issue.
  • Logs next to metrics: I'm using Grafana for my Telemetry Stack. Metrics will tell you that something has changed, and logs will tell you why.
  • History that outlives the router's buffer: The router keeps a limited log in memory. Loki keeps what you tell it to keep.
  • A searchable audit trail: Every commit produces an event that names the user and the source address. "Who changed PE2, and when?" becomes one query.
  • Counts and trends from text: Loki can count log lines over time, so "BGP sessions dropped per hour" becomes a graph without a second monitoring system.
  • Read-only access for the team: Colleagues can see events in Grafana without a login on the router.
  • Light and vendor-neutral: Loki indexes only labels, not the full text. Syslog is universal, so the same pipeline can take other vendors.

The Architecture

Figure: SR OS routers, Grafana Alloy, Loki, and Grafana on one VM

Component Role Notes
SR OS router Sends each event as a syslog message over UDP log-prefix sets the tag (PE1, PE2) and
Grafana Alloy Receives syslog, relabels and parses it, pushes to Loki Replaces Promtail
Loki Stores the log lines and a small label index Single container, filesystem storage, 7-day retention
Grafana Queries Loki with LogQL, alongside Prometheus Data source at http://loki:3100

Why Alloy and not Promtail

Promtail reached end of life on 2 March 2026, so it no longer gets updates. Grafana Alloy is its replacement and has a syslog receiver built in.

Why Loki

Loki does not index the text of every log line. It indexes a small set of labels and stores the lines in compressed chunks. That is why it is cheap to run, and it is why the choice of labels matters

What a message looks like and how it maps

This is an example of an event from my lab, as it arrives over the wire:

<188>Nov 15 23:47:35 172.20.20.19 PE1: 237 Base SYSTEM-WARNING-mdCommitSucceeded-2121 [Commit]:
Commit to configure by admin (MD-CLI) from 172.20.20.1 succeeded.
Message Example Where it ends up in Loki
Tag set by log-prefix PE1 Label router
Source in the header 172.20.20.19 Label hostname
First part of the event string SYSTEM Label subsystem
Second part of the event string WARNING Label log_severity
Event name mdCommitSucceeded Structured metadata event_name
Event ID 2121 Structured metadata event_id

Build it with Docker Compose

You need Docker and the Compose plugin, a router that can reach the VM/Server over UDP, and Grafana that you can add a data source to.

Step 1: Point the router at the VM/Server

This is MD-CLI. Replace with the address of your VM.

edit-config private
/configure log syslog "logviewer" description "SR OS to Loki"
/configure log syslog "logviewer" address <VM-IP>
/configure log syslog "logviewer" port 5514
/configure log syslog "logviewer" severity warning
/configure log syslog "logviewer" log-prefix "PE1"
/configure log log-id "20" admin-state enable
/configure log log-id "20" source main true
/configure log log-id "20" destination syslog "logviewer"
commit

Step 2: Prepare the VM/Server

mkdir -p ~/sros-logging && cd ~/sros-logging
sudo ss -ulnp | grep 5514 # must print nothing before you start

Only one process can listen on a UDP port. If that command prints a line, stop whatever owns the port first. If the router's packets do not arrive later, open the port in the firewall.

Step 3: Put Grafana and Loki on one network

On Docker's default bridge network, containers cannot find each other by name, so Grafana needs to reach Loki.

Step 4: Create the Loki config

Save this as loki-config.yaml.

auth_enabled: false

server:
  http_listen_port: 3100
  grpc_listen_port: 9096

common:
  instance_addr: 127.0.0.1
  path_prefix: /loki
  storage:
    filesystem:
      chunks_directory: /loki/chunks
      rules_directory: /loki/rules
  replication_factor: 1
  ring:
    kvstore:
      store: inmemory

schema_config:
  configs:
    - from: 2024-01-01
      store: tsdb
      object_store: filesystem
      schema: v13
      index:
        prefix: index_
        period: 24h

limits_config:
  retention_period: 168h
  allow_structured_metadata: true
  ingestion_rate_mb: 8
  ingestion_burst_size_mb: 16

compactor:
  working_directory: /loki/compactor
  retention_enabled: true
  delete_request_store: filesystem

Step 5: Create the Alloy config

Save this as config.alloy.

// config.alloy — SR OS syslog -> Loki
// Replaces Promtail (end-of-life since 2 March 2026).

// 1) Receive syslog from the router (BSD/RFC3164 format, UDP)
loki.source.syslog "sros" {
  listener {
    address       = "0.0.0.0:5514"
    protocol      = "udp"
    syslog_format = "rfc3164"

    // SR OS timestamps carry no year/timezone (they are UTC), so stamp each
    // entry with the time Alloy received it instead of trusting the header.
    use_incoming_timestamp = false

    labels = {
      job = "sros_syslog",
    }
  }

  relabel_rules = loki.relabel.sros.rules
  forward_to    = [loki.process.sros.receiver]
}

// 2) Keep the sending hostname/IP from the syslog header as a label
loki.relabel "sros" {
  forward_to = []

  rule {
    source_labels = ["__syslog_message_hostname"]
    target_label  = "hostname"
  }

  // SR OS puts the system name (PE1, PE2, ...) in the syslog tag
  rule {
    source_labels = ["__syslog_message_app_name"]
    target_label  = "router"
  }
}

// 3) Parse the SR OS event line
//    Body looks like:
//    28 Base ISIS-WARNING-tmnxIsisAdjacencyChange-2045 [VR:  1 ISIS (0) Adjacency state ]:  Adjacency status changed to down ...
//    <seq> <context> <SUBSYSTEM>-<SEVERITY>-<eventName>-<eventID> [<tag>]:  <text>
loki.process "sros" {
  stage.regex {
    expression = "^(?:\\S+:\\s+)?(?P<seq>\\d+)\\s+(?P<context>\\S+)\\s+(?P<subsystem>[A-Z0-9]+)-(?P<log_severity>[A-Z]+)-(?P<event_name>[A-Za-z0-9]+)-(?P<event_id>\\d+)\\s+\\[(?P<description>.*?)\\]:\\s*(?P<message>.*)$"
  }

  // Low-cardinality fields become Loki labels (fast filtering, cheap to index)
  stage.labels {
    values = {
      subsystem    = "",
      log_severity = "",
    }
  }

  // Higher-cardinality fields stay searchable without bloating the label index
  stage.structured_metadata {
    values = {
      event_name = "",
      event_id   = "",
    }
  }

  forward_to = [loki.write.local.receiver]
}

// 4) Ship to Loki
loki.write "local" {
  endpoint {
    url = "http://loki:3100/loki/api/v1/push"
  }
}

Step 6: Create the compose file

Save this as docker-compose.yml.

services:
  loki:
    image: grafana/loki:3.1.0
    container_name: loki
    command: -config.file=/etc/loki/local-config.yaml
    ports:
      - "127.0.0.1:3100:3100"      # for local curl/debug only
    volumes:
      - ./loki-config.yaml:/etc/loki/local-config.yaml:ro,z   # :z = SELinux relabel (Rocky)
      - loki-data:/loki
    networks:
      - monitoring
    restart: unless-stopped

  alloy:
    image: grafana/alloy:v1.10.0   # bump to the current release tag if you like
    container_name: alloy
    command:
      - run
      - --server.http.listen-addr=0.0.0.0:12345
      - --storage.path=/var/lib/alloy/data
      - /etc/alloy/config.alloy
    ports:
      - "5514:5514/udp"            # router sends syslog here
      - "127.0.0.1:12345:12345"    # Alloy UI: component health
    volumes:
      - ./config.alloy:/etc/alloy/config.alloy:ro,z
    networks:
      - monitoring
    depends_on:
      - loki
    restart: unless-stopped

volumes:
  loki-data:

networks:
  monitoring:
    external: true

Step 7: Start the stack

docker compose up -d
docker ps --filter name=loki --filter name=alloy

Step 8: Verify the pipeline

Loki takes about 30 seconds to become ready. Until then /ready returns 503, which is normal

curl -s http://127.0.0.1:3100/ready
ready

# proves Grafana can reach Loki
docker exec grafana wget -qO- http://loki:3100/ready
ready

# Look for any errors 
docker logs alloy --tail 20

Now make a trivial change and commit it on a router, which generates a few events. Then ask Loki what it has:

curl -s http://127.0.0.1:3100/loki/api/v1/labels
{"status":"success"}


curl -G -s http://127.0.0.1:3100/loki/api/v1/query_range --data-urlencode 'query={job="sros_syslog"}' --data-urlencode 'limit=3'

{"status":"success","data":{"resultType":"streams","result":[{"stream":{"detected_level":"warn","event_id":"2121","event_name":"mdCommitSucceeded","hostname":"172.20.20.20","job":"sros_syslog","log_severity":"WARNING","router":"PE2","service_name":"sros_syslog","subsystem":"SYSTEM"},"values":[["1795996813251258581","158 Base SYSTEM-WARNING-mdCommitSucceeded-2121 [Commit]:  Commit to configure by admin (MD-CLI) from 172.20.20.1 succeeded."]]},{"stream":{"detected_level":"warn","event_id":"2112","event_name":"ssiSaveBackgroundConfigSucceeded","hostname":"172.20.20.20","job":"sros_syslog","log_severity":"WARNING","router":"PE2","service_name":"sros_syslog","subsystem":"SYSTEM"},"values":[["1795996813270533762","159 Base SYSTEM-WARNING-ssiSaveBackgroundConfigSucceeded-2112 [Configuration Save Succeeds]:  Complete configuration file saved in the background to: cf3:\\config.cfg"]]},{"stream":{"detected_level":"warn","event_id":"2110","event_name":"ssiSaveIncrementConfigSucceeded","hostname":"172.20.20.20","job":"sros_syslog","log_severity":"WARNING","router":"PE2","service_name":"sros_syslog","subsystem":"SYSTEM"}

If you see that, the router, Alloy, and Loki are all working.

Step 9: Connect Grafana

In Grafana go to Connections, then Data sources, then Add data source, and choose Loki. Set the URL to http://loki:3100 and click Save and test. Then open Explore, pick the Loki data source, and run:

{job="sros_syslog"}

Your router events should appear. From here, you can filter by router, subsystem or log_severity and search the text of the lines.

Optional: look at the Alloy UI

Alloy has a status page, and the compose file publishes it on the VM's loopback address only. It has no login, so do not expose it. Reach it with an SSH tunnel from your laptop:

ssh -N -L 12346:127.0.0.1:12345 user@<VM-IP>

Then browse to http://localhost:12346. The Graph page shows the four components connected, and each should report as healthy.

Grafana Dashboards

This is the last piece of the puzzle. I have published articles demonstrating how dashboards can be built.

Below are panels I have built :

Live Events

Events by Severity

Events per router

Config commits

Major/Critical events

Conditions to keep in mind

  • UDP can lose messages. That is fine in a lab. For anything that matters, use TCP, ideally with TLS, on both the router and the Alloy listener.
  • This was tested in a lab. The versions were Loki 3.1.0 and Alloy v1.10.0 against SR OS (SR-SIM) release 25.10.R4
  • Nothing in my lab setup is authenticated. Loki and the Alloy UI are bound to the loopback address. Put authentication in front of them before exposing either to a wider network.
  • Retention is 7 days. Change retention_period to suit your disk

Summary

Syslog already holds the story of what your network did and when. Sending it through Alloy into Loki and viewing it in Grafana puts that story in one searchable place, next to your metrics, with history and structure that the router's own log cannot give you.

No comments yet. Be the first to comment.