Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Gen AI] [ Integration Assistant ] Modify pipeline template …
…to handle dates as array of string in the logs (elastic#187643) ## Summary There could be [scenario](https://docs.paloaltonetworks.com/iot/iot-security-api-reference/iot-security-api/get-vulnerability-instances) where a date can come in as an array - `"detected_date": [ "2021-04-19T23:59:59" ],` The `date` processor fails to handle an array with a string. This PR adds a `script` processor as a pre processor to date processor to convert the array of string into a string. Pipeline after the changes ```json { "script": { "tag": "script_convert_array_to_string", "description": "Ensures the date processor does not receive an array value.", "lang": "painless", "source": "if (ctx.palo_alto_iot.vulnerability.detected_date instanceof ArrayList){\n ctx.palo_alto_iot.vulnerability.detected_date = ctx.palo_alto_iot.vulnerability.detected_date[0];\n}\n" } }, { "date": { "if": "ctx.palo_alto_iot?.vulnerability?.detected_date != null", "tag": "date_processor_palo_alto_iot.vulnerability.detected_date", "field": "palo_alto_iot.vulnerability.detected_date", "target_field": "event.start", "formats": [ "ISO8601" ] } } ``` --------- Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information