Reply
New Contributor
Posts: 3
Registered: ‎12-20-2015

extractJsonPaths failed to extract value with special char

Hi.

 

I have a question regarding the extractJsonPaths command.

 

I have the following Json object.

 

{
"message": "64.242.88.10 - - [07/Mar/2004:16:05:49 -0800] \"GET /twiki/bin/edit/Main/Double_bounce_sender?topicparent=Main.ConfigurationVariables HTTP/1.1\" 401 12846\r",
"@timestamp": "2016-01-07T15:23:16.263Z",
"host": "localhost.localdom",
"TZ": "UTC"
}

 

I am trying to extract the values with the following conf:

 

morphlines : [
{
id : default
importCommands : ["org.kitesdk.**"]

commands : [
{ readJson {} }

{ extractJsonPaths {
flatten : false
paths : {
host : "/host"
timestamp : "/@timestamp"
msg : "/message"
timezone : "/TZ"
}
}
}
]
}
]

 

The message field is problemtic because it includes extra quatation marks, even though they are backslashed.

Does anyone know how to overcome this?

Announcements
The Kite SDK is a collection of docs, sample code, APIs, and tools to make Hadoop application development faster. Learn more at http://kitesdk.org.