crowdsec unifi collection breaks with newest release 10.1.78
UniFi Collection: Incompatibility with UDM-SE/UDM-Pro (OpenSSH + CEF Format)
Description
The crowdsecurity/unifi collection parsers fail to parse logs from UniFi Dream Machine SE (UDM-SE) and likely UDM-Pro devices due to differences in SSH daemon and CEF field ordering compared to older UniFi hardware.
Environment
- UniFi Device: Dream Machine SE (UDM-SE)
- Firmware Version: 10.1.78 (UniFi Network)
- CrowdSec Version: Latest (tested January 2025)
- Collection Version:
crowdsecurity/unifiv0.2
Issues Identified
1. SSH Logs Not Parsed (OpenSSH vs Dropbear)
Problem: UDM-SE uses OpenSSH (sshd), but the collection only includes parsers for Dropbear logs.
Example Log Line:
Jan 25 01:35:01 UDM-SE UDM-SE[-]: sshd[2559218]: Invalid user fakeuser from 192.168.1.50 port 56926
Current Behavior:
crowdsecurity/unifi-logsparses the raw syslog format ✅crowdsecurity/dropbear-logsfails (device uses sshd, not dropbear) ❌crowdsecurity/sshd-logsfails (doesn't match UniFi syslog format) ❌
Result: SSH brute force attempts are not detected.
2. CEF Format Field Order Mismatch
Problem: The crowdsecurity/unifi-cef parser expects CEF fields in a specific order with UNIFIsubCategory present, but UDM-SE sends fields in a different order and omits UNIFIsubCategory.
Example CEF Log:
0|Ubiquiti|UniFi Network|10.1.78|544|Admin Accessed UniFi Network|1|src=192.168.1.229 UNIFIcategory=Audit UNIFIhost=UDM-SE UNIFIaccessMethod=web UNIFIadmin=Branden UNIFIutcTime=2026-01-25T00:48:36.337Z msg=Branden accessed UniFi Network using the web. Source IP: 192.168.1.229
Expected by Parser (UNIFI_ADMIN_PATTERN):
UNIFIcategory=X UNIFIsubCategory=Y UNIFIhost=Z UNIFIaccessMethod=W UNIFIadmin=V src=IP ...
Actual from UDM-SE:
src=IP UNIFIcategory=X UNIFIhost=Z UNIFIaccessMethod=W UNIFIadmin=V UNIFIutcTime=... (no UNIFIsubCategory)
Current Behavior:
crowdsecurity/cef-logsparses CEF structure ✅crowdsecurity/unifi-ceffails to extract fields ❌
Result: Admin access events and security alerts are not parsed for scenarios.
Working Custom Parsers
I've created custom parsers that work with UDM-SE. These could be integrated into the collection:
Custom UniFi SSH Parser
File: parsers/s01-parse/unifi-sshd.yaml
onsuccess: next_stage
filter: "evt.Parsed.message startsWith 'sshd'"
name: crowdsecurity/unifi-sshd
description: "Parse UniFi OpenSSH (sshd) logs for UDM devices"
grok:
pattern: 'sshd\[%{INT:pid}\]: Invalid user %{USER:sshd_invalid_user} from %{IPORHOST:source_ip}( port %{INT:source_port})?'
apply_on: message
statics:
- meta: service
value: ssh
- meta: source_ip
expression: evt.Parsed.source_ip
- meta: log_type
value: ssh_failed-auth
- target: evt.StrTime
expression: evt.Parsed.timestamp
Custom UniFi CEF Parser
File: parsers/s01-parse/unifi-cef-udm.yaml
onsuccess: next_stage
filter: "evt.Parsed.cef_device_vendor == 'Ubiquiti' && evt.Parsed.cef_device_product == 'UniFi Network'"
name: crowdsecurity/unifi-cef-udm
description: "Parse UniFi CEF logs for UDM devices (alternate field order)"
pattern_syntax:
UNIFI_ADMIN_PATTERN: 'src=(%{IP:src_ip}) UNIFIcategory=(%{DATA:unifi_category}) UNIFIhost=(%{DATA:unifi_host}) UNIFIaccessMethod=(%{DATA:unifi_access_method}) UNIFIadmin=(%{DATA:unifi_admin}) UNIFIutcTime=(%{DATA:unifi_utc_time}) msg=(%{GREEDYDATA:msg})'
nodes:
- grok:
pattern: '%{UNIFI_ADMIN_PATTERN}'
apply_on: message
statics:
- meta: service
value: unifi
- meta: source_ip
expression: evt.Parsed.src_ip
- meta: admin_user
expression: evt.Parsed.unifi_admin
- meta: category
expression: evt.Parsed.unifi_category
- meta: access_method
expression: evt.Parsed.unifi_access_method
- meta: host
expression: evt.Parsed.unifi_host
- meta: message
expression: evt.Parsed.msg
- target: evt.StrTime
expression: evt.Parsed.unifi_utc_time
Proposed Solutions
Option 1: Update Existing Parsers
- Make
unifi-cefparser more flexible with multiple pattern variations - Add OpenSSH support to the UniFi collection
Option 2: Add Device-Specific Parsers
- Keep existing parsers for legacy devices (USG, CloudKey with Dropbear)
- Add new parsers specifically for UDM/UDM-Pro devices (OpenSSH)
Option 3: Auto-Detection
- Create a generic parser that auto-detects CEF field order
- Add logic to detect SSH daemon type (dropbear vs sshd)
Testing
I've verified these custom parsers work correctly with:
- SSH brute force detection (
crowdsecurity/ssh-bfscenario) - CEF admin access logging
- Real-time log parsing from rsyslog
Additional Information
- UDM-SE logs are received via rsyslog on UDP port 4242
- Logs are split into CEF and syslog files based on the
CEFprogram name - The
crowdsecurity/unifi-logss00-raw parser works correctly; only s01-parse stage parsers need updates
Impact
This affects anyone using:
- UniFi Dream Machine (UDM)
- UniFi Dream Machine Pro (UDM-Pro)
- UniFi Dream Machine SE (UDM-SE)
- Possibly newer UniFi Express devices
Hey! already had #1663 in works cause unifi is rapidily changing the CEF format and we cant keep up with every changing update and having to handle multiple versions, so we added a helper which can handle this more gracefully.
With the sshd log lines, are you using the templates we provided in the unifi collection EG:
module(load="imudp")
# Only allow your senders (legacy-style; applies to all UDP inputs)
$AllowedSender UDP, 192.168.1.0/24, 192.168.11.1/32
# Templates
template(name="CEF" type="string" string="%msg%\n")
template(name="Syslog" type="string" string="%timegenerated% %hostname% %programname%[%procid%]: %msg%\n")
# Bind the UDP/4242 input to a ruleset so only those messages hit the UniFi actions
input(
type="imudp"
name="unifi_in"
port="4242"
ruleset="unifi"
)
ruleset(name="unifi") {
if $rawmsg startswith "CEF:" then {
action(type="omfile" file="/var/log/unifi-cef.log" template="CEF")
} else {
action(type="omfile" file="/var/log/unifi-syslog.log" template="Syslog")
}
stop
}
as im surprised that it logging the sshd within the message and not as the program name property which syslog knows to parse from the incoming rsyslog.
Sorry if I am hijacking it, I don't mind to, I have the similar issue with CEF logs.
My CEF logs are in this format
Mar 11 10:15:08 Dream-Machine CEF[-]: 0|Ubiquiti|UniFi Network|10.1.85|201|Threat Detected and Blocked|7|proto=TCP src=176.65.149.234 spt=49939 dst=192.168.50.65 dpt=80 act=blocked app=HTTP UNIFIcategory=Security UNIFIhost=Dream Machine UNIFIrisk=medium UNIFIpolicyName=DShield Block List UNIFIpolicyType=IDS/IPS UNIFIdirection=incoming deviceOutboundInterface=50-VirtualMachines UNIFIdeviceMac=d0:21:f9:5c:02:dd UNIFIdeviceName=Dream Machine UNIFIdeviceModel=UDM-Pro UNIFIdeviceIp=192.168.1.1 UNIFIdeviceVersion=5.0.12 UNIFIsrcRegion=NL UNIFIdstZone=Dmz UNIFItotalBytes=58 UNIFItotalPackets=1 UNIFIpacketsReceived=0 UNIFIpacketsSent=1 UNIFIbytesReceived=0 UNIFIbytesSent=58 UNIFIflowCount=1 UNIFIflowId=null UNIFIflowStartTime=Mar 11, 2026 at 11:15:06.923 AM UNIFIipsSessionId=2111162194467164 UNIFIipsSignature=ET DROP Dshield Block Listed Source group 1 UNIFIipsSignatureId=2402000 UNIFIutcTime=2026-03-11T10:15:08.452Z msg=A network intrusion attempt from 176.65.149.234 to 192.168.50.65 has been detected and blocked.
I think they indeed changed the format, and unifi-cem.log is no longer getting filled. I am using Unifi Network 10.1.85