# Only String and Array types are splittable. field:\[array\]\[method\] is of type = NilClass"

**URL:** <https://discuss.elastic.co/t/only-string-and-array-types-are-splittable-field-array-method-is-of-type-nilclass/295861>\
**Category:** Logstash\
**Created:** [January 31, 2022, 3:21pm UTC](https://discuss.elastic.co/t/only-string-and-array-types-are-splittable-field-array-method-is-of-type-nilclass/295861 "2022-01-31T15:21:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rutika\_kamble](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rutika_kamble/32/101002_2.png) [@rutika\_kamble](https://discuss.elastic.co/u/rutika_kamble)\
**Post date:** [January 31, 2022, 3:21pm UTC](https://discuss.elastic.co/t/only-string-and-array-types-are-splittable-field-array-method-is-of-type-nilclass/295861/1 "2022-01-31T15:21:39Z")

</div>

I am trying to input JSON data from logs through logstash to Elasticsearch but I am getting this error field:[array][method] is of type = NilClass" Preformatted text

Please find my logstash conf file-

```auto
input {
	http {
		host => "localhost"
		port => 5290
	}
}

filter {
	mutate{
		rename => {
			"[headers][logtype]" => "logtype"
		}
	}
	
	if [logtype] == "alertservice" {
		split { 
			field => "array"
			

		}
		
		mutate{
			rename => {
				"[array][tenant]" => "tenant"
				"[array][username]" => "username"
				"[array][machinename]" => "machinename"
				"[array][severity]" => "severity"
				"[array][eventid]" => "eventid"
				"[array][logid]" => "logid"
				"[array][eventtype]" => "eventtype"
				"[array][eventtime]" => "eventtime"
				"[array][domain]" => "domain"
				"[array][details]" => "details"
				"[array][collection]" => "collection"
			}
			
			remove_field => ["array"]
		}
	}
	
	date {
		match => ["timestamp", "UNIX_MS"]
	}
	
	mutate {
		convert => { 
			"timestamp" => "integer"
		}
	}
	
	mutate {
		add_field => ["month","%{+MM}","year","%{+YYYY}","day","%{+dd}"]
	}
	
	mutate {
		convert => { 
			"day" => "integer"
			"month" => "integer"
			"year" => "integer"
		}
	}
	
	mutate {
		remove_field => ["message", "@version", "host", "headers", "tags"]
		remove_tag => ["message", "@version", "host", "headers", "tags"]
	}
}

output {
	stdout {
		codec => rubydebug
	}
	
	elasticsearch {
		index => "%{tenant}"
		hosts => ["localhost:9200"]
		manage_template => false
	}
}

```

How to fix this?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 28, 2022, 3:22pm UTC](https://discuss.elastic.co/t/only-string-and-array-types-are-splittable-field-array-method-is-of-type-nilclass/295861/2 "2022-02-28T15:22:05Z")

</div>

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