Dashboards & Visualizations

Can the XML REST API _raw field highlighting be turned off?

beezly
Explorer

The XML REST API is returning mangled results. It looks like it is applying some sort of highlighting syntaxt to the _raw field;

The contents of the raw filed have the search string I queried for wrapped by <sg h="1">[query string]</sg>. Is there a way to turn this behaviour off?

Tags (4)
1 Solution

Stephen_Sorkin
Splunk Employee
Splunk Employee

Unfortunately this is not possible. I will file a request on your behalf to allow this.

View solution in original post

elazaroh
New Member

This is specific to the PowerShell SDK, and somewhat ugly, but might give you some ideas on hacking your way around this quirk.

In Splunk-Search.psm1, on line 142, I changed this:

{$_.k -eq "_raw"}           { $Myobj.Add("raw",$_.v.'#text');continue}

to this:

{$_.k -eq "_raw"}   {
    $rawTemp =  $_.v.OuterXml     
    $rawTemp = $rawTemp -replace "<v xml:space=`"preserve`" trunc=`"0`">", ""    
    $rawTemp = $rawTemp -replace "<sg h=`"1`">", "" 
    $rawTemp = $rawTemp -replace "</sg>", ""   
    $rawTemp = $rawTemp -replace "</v>", ""
    #write-host "rawTemp: $rawTemp";
    $Myobj.Add("raw",$rawTemp);continue}

Good luck

0 Karma

dwhytock
Explorer

Yes, please, on that request. This is greatly interfering with my JAXB handling of the results.

BTW, this was also asked three years ago, in

http://splunk-base.splunk.com/answers/6678/how-do-i-turn-off-highlighting

0 Karma

Stephen_Sorkin
Splunk Employee
Splunk Employee

Unfortunately this is not possible. I will file a request on your behalf to allow this.

araitz
Splunk Employee
Splunk Employee

Sorkin knows best, +1 on the request.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...

Customer success is front and center at .conf25

Hi Splunkers, If you are not able to be at .conf25 in person, you can still learn about all the latest news ...