π§© CEF, But Not Quite: UniFi OS Events Break the Format
In my previous post, I wrote that UniFi devices can generate CEF events for both UniFi OS and UniFi Network. I need to clarify that statement.
Because only one of those event types is correctly formatted as CEF. The other? Parsers won’t even touch it.
What CEF is supposed to look like
To make sense of this, let’s first recap what a CEF event is supposed to look like. The official documentation for the format is here:
π Micro Focus CEF Implementation Standard
According to the spec, a typical CEF header looks like this:
CEF:Version|Device Vendor|Device Product|Device Version|Device Event Class ID|Name|Severity|[Extension]
Here’s a partial sample CEF event from a UniFi Network device:
Aug 05 15:35:08 pandora CEF:0|Ubiquiti|UniFi Network|9.3.45|201|Threat Detected and Blocked|7|proto=TCP src=81.181.129.172…
Parsed out, we get:
- Version: 0
- Device Vendor: Ubiquiti
- Device Product: UniFi Network
- Device Version: 9.3.45
- Device Event Class ID: 201
- Name: Threat Detected and Blocked
- Severity: 7
- Extension: proto=TCP src=81.181.129.172…
No surprises there—everything is where it should be.
Now let’s look at a UniFi OS event
Aug 05 20:34:54 pandora CEF:0|Ubiquiti|UniFi OS|4.3.6|admins|1|msg=mindthelog accessed the UniFi OS via unifi.ui.com. Source IP: 1.2.3.4
Apply the same field breakdown:
- Version: 0
- Device Vendor: Ubiquiti
- Device Product: UniFi OS
- Device Version: 4.3.6
- Device Event Class ID: admins
- Name: 1
- Severity: msg=mindthelog…
Wait—what?
“1” is not a meaningful event name, and the severity field is completely off. According to the CEF spec, the Severity
field must either be a number (0–10) or one of the strings: Unknown
, Low
, Medium
, High
, or Very-High
.
Here, it contains msg=…
—which clearly belongs in the extension field.
My guess: the Device Event Class ID or Name field is missing. That would throw off the entire parsing structure, shifting everything after the Device Version field one field to the left.
Parsers don’t like this
Most CEF parsers throw errors when they see this malformed structure. For example, my log management system reports:
In my case, msg=…
ended up in the Severity field, which is invalid. I had to split the event into two parts, insert a missing field in between the two parts, and reassemble it—just to make it parseable.
No, I’m not going to tell you what value I used for the missing field.
Conclusion
If the Device Product
is UniFi OS, the event is not a properly formatted CEF message. It won’t be parsed by any standards-compliant CEF parser without custom logic or workarounds.
Dear Ubiquiti: I’ve created a workaround for my log management system. But wouldn’t it be better if the events were formatted correctly in the first place?
Comments
Post a Comment