Remove data from json array in Logstash

I have a data source which is sending in data in json format. Some of this data is held in an array, which makes it difficult to visualize. The array only holds one set of data however.

For example, the "docs" array below:

"childproc_count":1,"cmdline":"C:\WINDOWS\splwow64.exe 8192",

I want to be able to remove the name "docs" and the brackets around the "docs" array and be left with a list of fields separated by commas. I tried to do it with this filter but it generates lots of number_format_exception errors in the Logstash logs.

The data still seems to load in Elasticsearch but I don't know if it's missing any.

		if '\"docs\"\:\[' in ["message"] {
			mutate {
				gsub => [ 
				"message", '\,\"docs\"\:\[\{' , '\,' ,
				"message", '\}\]\,' , '\,' 
			source => "message"

Is there a better way to extract the data from a single value json array?

And what does number_format_exception mean when parsing data in Logstash?

Thank you.

I'm not sure about the array. But if you want to index something in a nested json you just can apply the json filter twice. It have worked for me at least.

json {
source => "message"
json {
source => "docs"

After this you can remove the doc index with a simple mutate -> remove_field filter.

Thanks for the reply. I thought it had worked at first as I was seeing data come in with no errors but it didn't. I still get this in the logstash log:

{:timestamp=>"2016-06-30T10:21:21.398000-0700", :message=>"Error parsing json", :source=>"docs", :raw=>[{"......"}], :exception=>java.lang.ClassCastException, :level=>:warn}

The event is then tagged with _jsonparsefailure and I don't see the fields from within the array.

I think I have it now. If the array exists, I split it. I also need to convert one of the fields to a string as we have some wonky data in some events (name instead of number) but this works:

	if "**********" in [tags] {
		json {
			source => "message"
		if [docs] {
			split {
				field => "[docs]"
				add_tag => ["splitted_docs"]
			mutate {
				convert => { "watchlist_id" => "string"}
		date {
			match => [ "timestamp","UNIX" ]
			target => "@timestamp"