Skip to content

Update sqs-files to support CEF parsing#260

Open
0BL1V10N-55 wants to merge 1 commit into
refractionPOINT:masterfrom
0BL1V10N-55:imperva_parsing
Open

Update sqs-files to support CEF parsing#260
0BL1V10N-55 wants to merge 1 commit into
refractionPOINT:masterfrom
0BL1V10N-55:imperva_parsing

Conversation

@0BL1V10N-55
Copy link
Copy Markdown

Description of the change

New Config Option for CEF message parsing

Description here

IsCEFFormat bool (line 74) - Enables CEF parsing mode for Imperva/Incapsula WAF logs New Functions Added
Function Lines Purpose

processCEFEvent() 350-416 Main handler - reads file line-by-line, parses CEF, ships JSON events
parseCEF() 420-457 Parses CEF header (7 pipe-separated fields) + extension key=value pairs
splitCEFHeader() 460-509 Splits CEF line by `
unescapeCEFHeader() 512-516 Unescapes | and \ in header fields
parseCEFExtension() 519-600 Parses key=value pairs from CEF extension section
isValidCEFKeyChar() 603-608 Validates CEF key characters (alphanumeric + underscore)
unescapeCEFExtension() 611-617 Unescapes =, \n, \r, \ in extension values Modified Function
processEvent() (line 315-319) - Added check: if IsCEFFormat is true, routes to processCEFEvent() instead of bundling raw data Behavior

Non-CEF lines (headers like accountId:, |==|) trigger a warning and are shipped as raw text CEF lines are parsed into structured JSON with header fields (device_vendor, severity, etc.) and all extension key-value pairs

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • [X ] New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Related issues

https://refractionpoint.slack.com/archives/C08N44C603U/p1769014508093499?thread_ts=1769014414.452029&cid=C08N44C603U

New Config Option
IsCEFFormat bool (line 74) - Enables CEF parsing mode for Imperva/Incapsula WAF logs
New Functions Added
Function	Lines	Purpose
processCEFEvent()	350-416	Main handler - reads file line-by-line, parses CEF, ships JSON events
parseCEF()	420-457	Parses CEF header (7 pipe-separated fields) + extension key=value pairs
splitCEFHeader()	460-509	Splits CEF line by `
unescapeCEFHeader()	512-516	Unescapes | and \\ in header fields
parseCEFExtension()	519-600	Parses key=value pairs from CEF extension section
isValidCEFKeyChar()	603-608	Validates CEF key characters (alphanumeric + underscore)
unescapeCEFExtension()	611-617	Unescapes \=, \n, \r, \\ in extension values
Modified Function
processEvent() (line 315-319) - Added check: if IsCEFFormat is true, routes to processCEFEvent() instead of bundling raw data
Behavior
Non-CEF lines (headers like accountId:, |==|) trigger a warning and are shipped as raw text
CEF lines are parsed into structured JSON with header fields (device_vendor, severity, etc.) and all extension key-value pairs
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.

1 participant