Hello,
I'm having a problem with the csv plugin (seems the same problem as in this old (2018) article)
Quoted strings within fields that do not contain the field separator are interpreted as fields, and this provokes a parsing error.
For example, this input line:
2025-10-16 01:44:55,"style :expression (" (Parameter),5,64.39.106.92,10.97.203.236,/Common/dem-www-pr_443,Cross Site Scripting (XSS),1.0
raises the following error:
Error parsing csv {:field=>"message", :source=>"2025-10-16 01:44:55,\"style :expression (\" (Parameter),5,64.39.106.92,10.97.203.236,/Common/dem-www-pr_443,Cross Site Scripting (XSS),1.0", :exception=>#<CSV::MalformedCSVError: Missing or stray quote in line 1>
If I set a different char as quote_char:
csv {
columns => [ "Date_Time", "Signature_Name", "Severity_Id", "Source_Ip", "Destination_Ip", "Policy", "Attack_Type", "Hit_Counter"]
separator => ","
quote_char => '§'
}
records with fields that contain the separator character, and are therefore quoted, are incorrectly split:
2025-10-16 20:54:44,"Generic Remote File/Path Include Attempt 4 (dir param, http/https)",4,64.39.106.3,10.97.219.194,/Common/pdc-www-pr_80,Remote File Include,1.0
the second field, Signature_Name
, is terminated at the comma: "Signature_Name"=>"\"Generic Remote File/Path Include Attempt 4 (dir param",
, and a new autonamed field gets added: "column9"=>"1.0"
The whole record, then, get rejected by Elastic:
Could not index event to Elasticsearch. {:status=>400, [ . . . ] "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [Source_Ip] of type [ip] in document with id 'qFaL8ZkBMYlRvXlrtBPW'. Preview of field's value: '4'"
The plugin version is logstash-filter-csv (3.1.1)
. As it was released in June 2021, I suppose this bug isn't going to be fixed, so any advice for a workaround is welcome
Paolo