Skip to content

feat: add UniFi Syslog (CEF) adapter#264

Open
ecapuano wants to merge 1 commit intorefractionPOINT:masterfrom
ecapuano:feat/unifi-syslog-adapter
Open

feat: add UniFi Syslog (CEF) adapter#264
ecapuano wants to merge 1 commit intorefractionPOINT:masterfrom
ecapuano:feat/unifi-syslog-adapter

Conversation

@ecapuano
Copy link
Copy Markdown

@ecapuano ecapuano commented Feb 6, 2026

Summary

  • New unifi_syslog adapter that listens for syslog traffic (TCP/UDP/TLS) and parses UniFi CEF (Common Event Format) events into structured JSON
  • CEF lines are split into header fields (device_vendor, device_product, device_event_class_id, name, severity, etc.) plus parsed extension key=value pairs, shipped as JsonPayload
  • Non-CEF syslog lines are parsed into structured BSD syslog fields (timestamp, hostname, process, pid, message) with automatic JSON detection for embedded payloads (e.g., coredns ad-block logs)
  • Handles UniFi-specific quirks: doubled hostname in syslog, UNIFI-prefixed CEF extension keys, syslog priority headers
  • Network listener follows the existing syslog adapter pattern exactly (TCP/UDP/TLS/mutual TLS, StreamTokenizer for TCP framing)

Context

UniFi controllers (v9.3.43+) support SIEM log export in CEF format via syslog. The existing syslog adapter ships raw text (TextPayload), which doesn't leverage CEF's structured format. This dedicated adapter parses CEF into structured JSON, enabling richer detection rules and queries in LimaCharlie.

Test plan

  • go build ./containers/general compiles
  • go vet ./unifi_syslog/... clean
  • go test ./... — all tests pass (18 new tests for CEF + syslog parsing)
  • End-to-end tested with real UniFi UDM-Pro-Max syslog output over UDP
  • Verified CEF events arrive as structured JSON in LimaCharlie
  • Verified non-CEF syslog (kernel, earlyoom, coredns JSON) parsed correctly

Syslog listener that parses UniFi CEF events into structured JSON.
CEF lines are parsed into header fields + extension key=value pairs
and shipped as JsonPayload. Non-CEF syslog is parsed into structured
BSD syslog fields (timestamp, hostname, process, pid, message) with
automatic JSON detection for embedded payloads.

Supports TCP, UDP, TLS, and mutual TLS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants