What to put in logstash config if ther is null for lat & long?

What to put in logstash config if ther is null for lat & long?
Some rows do not have gps_long nor gps_lat coordinates. SQL input returns NULL.
But null is rejected by logstash or ES.
My logstash config:

	mutate {
		rename => {
			"gps_long" => "[location][lon]"
			"gps_lat" => "[location][lat]"
		}
	}

This manual is not clear at all https://www.elastic.co/guide/en/elasticsearch/reference/6.3/geo-point.html
What is ' null_value' and where I should put it? In mapping? If included in mapping then I can send rows with null in geo_lat and geo_long?

Why not just remove the field?

Some rows contains geo coordinates, some not. I do not know which ones are empty. So I cannot remove those fields (I need them). Temp solution is to put '0.0' but this generate wrong coordinate. Null seems to be logical solution but for some reason coder disabled that.

You should be able to check which ones are empty in the Logstash config and only remove the field if that is the case.

Javascript works in config? Any example?

Use standard conditionals.

You can check for the existence of a specific field, but there’s currently no way to differentiate between a field that doesn’t exist versus a field that’s simply false. The expression `if [foo]` returns `false` when:

* `[foo]` doesn’t exist in the event,
* `[foo]` exists in the event, but is false, or
* `[foo]` exists in the event, but is null

So, there is no way to determine if field contain NULL or not. I made a workaround modifying SQL so it returns 'null' string if null in table and removing geo_point field in Logstash filter when it contains string 'null'.
Thanks for help

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