Parsing Inner JSON - Array of JSON Objects

The following is the content of my JSON. I am trying to parse the nested JSON.
I tried to use the Split filter for the same but I am facing the error.

{
"School": {
	"Details": [{
		"Name": "a",
		"Class": "1"
	}, {
		"Name": "b",
		"Class": "2"
	}, {
		"Name": "c",
		"Class": "3"
	}, {
		"Name": "d",
		"Class": "4"
	}]
}

}

Logstash Configuration

input {

file {

	path => "/home/user/Desktop/custom_log.txt"
	start_position => beginning
	ignore_older => 0
	codec => "json"
}

}

filter {
split {
field => "Details"
}
}

output {

stdout {
	codec => rubydebug
}

}

Error :
LogStash::ConfigurationError: Only String and Array types are splittable. field:Details is of type = NilClass

Hi @shivkumar
I am not pretty sure, but shouldn't you give the field "Details" as School['Details'] ?

Use

split { field => "[School][Details]" }
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.