- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
09-18-2024 08:50 AM
Hello all,
We're writing a custom playbook in Cortex XSOAR that queries Splunk and returns data. The data we receive back from Splunk (via a self-written XSOAR automation, in Python) gets returned as an XML field containing a string that represents a flat CSV file. The \n character sequence (newline) gets added by Splunk to delimit each new line. When prototyping this code via a test incident and using the FileCreateAndUploadV2 command, it errors when the data parameter contains this escape sequence. What is the best way to wrangle the CSV data into an attachment?
Best!
09-23-2024 02:47 AM
PEBKAC -- Found that passing in the data= argument to the FileCreateAndUploadV2 command can be arbitrary when used from within an automation. The string we passed to it be formatted in whichever way necessary. Getting a CSV with or without newlines is accepted when done via Python scripting. This works as intended for us now.
09-19-2024 06:42 AM
Update: Part of this issue has been resolved by not using the war room to prototype anymore. The command still persists with the invalid escape sequence error when including \n, however this is not true when using shift+enter to manually insert a linebreak into the markdown field.
Since this will live in an automation, there's been success with using Python string literals to include linebreaks and submit them to the FileCreateAndUploadV2 command, which is then executed using demisto.executeCommand().
09-23-2024 02:47 AM
PEBKAC -- Found that passing in the data= argument to the FileCreateAndUploadV2 command can be arbitrary when used from within an automation. The string we passed to it be formatted in whichever way necessary. Getting a CSV with or without newlines is accepted when done via Python scripting. This works as intended for us now.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!