Getting Data In

New line appears in event as "\n" -- how can I replace them with a new line?

jambajuice
Communicator

I'm working with Nessus vulnerability scanner results such as the following:

results|192.168.1|192.168.1.100|general/tcp|19506|Security Note|\nSynopsis :\n\nInformation about the Nessus scan.\n\nDescription :\n\nThis script displays, for each tested host, information about the scan itself:\n\n - The version of the plugin set\n - The type of plugin feed (HomeFeed or ProfessionalFeed)\n - The version of the Nessus Engine\n - The port scanner(s) used\n - The port range scanned\n - The date of the scan\n - The duration of the scan\n - The number of hosts scanned in parallel\n - The number of checks done in parallel\n\nSolution :\n\nn/a\n\nRisk factor :\n\nNone\n\nPlugin output :\n\nInformation about this scan : \n\nNessus version : 4.4.0 (Build 15045)\nPlugin feed version : 201012101834\nType of plugin feed : HomeFeed (Non-commercial use only)\nScanner IP : 192.168.1.100\nPort scanner(s) : nessus_syn_scanner \nPort range : default\nThorough tests : no\nExperimental tests : no\nParanoia level : 1\nReport Verbosity : 1\nSafe checks : yes\nOptimize the test : yes\nCGI scanning : disabled\nWeb application tests : disabled\nMax hosts : 20\nMax checks : 4\nRecv timeout : 5\nBackports : None\nScan Start Date : 2010/12/11 13:14\nScan duration : 246 sec\n\n

I want those \n characters to be treated as a new line. I tried the following in transforms.conf and it didn't work:

[nessus]
MAX_EVENTS = 1
SEDCMD-carriage_return = /s\\n/\n

Is it possible for SED to replace a character with a special character?

Thx.

Craig

Tags (1)
0 Karma

mbrunetto
Path Finder

Try this...

SEDCMD-carriage_return = s/\\\n/\n/g

I do it in a rex at searchtime, so I'm using

rex field=SUMMARY mode=sed "s/\\\n/\n/g"

0 Karma

ontai
Explorer

I've tried this as well, but the SEDCMD only works when run from the command line. When I put it in the props.conf, it doesn't make the change.

0 Karma

Ledion_Bitincka
Splunk Employee
Splunk Employee

Can you please try the following stanza instead (seems like the sed syntax in your stanza is not correct)

[nessus]
MAX_EVENTS = 1
SEDCMD-carriage_return = s/\\n/\n/g
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Make Your Machine Data AI-Ready in Splunk

Every team is getting ready for AI agents.    Watch On-Demand   In this Tech Talk, Splunk platform specialists ...

How to Break a Kubernetes Pod on Purpose and Let the AI Troubleshooting Agent Find ...

Let's say I've just rolled out a Kubernetes Deployment with a typo in the image tag. Nothing explodes. The pod ...

Splunk Add-on for Microsoft Windows 11.0.3: Parse Once, Search Faster

The updated Splunk Add-on for Microsoft Windows helps customers search Windows events faster by reducing ...