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

**URL:** <https://discuss.elastic.co/t/what-to-put-in-logstash-config-if-ther-is-null-for-lat-long/149600>\
**Category:** Logstash\
**Created:** [September 23, 2018, 6:19pm UTC](https://discuss.elastic.co/t/what-to-put-in-logstash-config-if-ther-is-null-for-lat-long/149600 "2018-09-23T18:19:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gosforth](https://avatars.discourse-cdn.com/v4/letter/g/f08c70/32.png) [@Gosforth](https://discuss.elastic.co/u/Gosforth)\
**Post date:** [September 23, 2018, 6:19pm UTC](https://discuss.elastic.co/t/what-to-put-in-logstash-config-if-ther-is-null-for-lat-long/149600/1 "2018-09-23T18:19:29Z")

</div>

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](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?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [September 24, 2018, 5:21am UTC](https://discuss.elastic.co/t/what-to-put-in-logstash-config-if-ther-is-null-for-lat-long/149600/2 "2018-09-24T05:21:49Z")

</div>

Why not just remove the field?

---

<div class="post-metadata">

**Author:** ![Gosforth](https://avatars.discourse-cdn.com/v4/letter/g/f08c70/32.png) [@Gosforth](https://discuss.elastic.co/u/Gosforth)\
**Post date:** [September 27, 2018, 6:04pm UTC](https://discuss.elastic.co/t/what-to-put-in-logstash-config-if-ther-is-null-for-lat-long/149600/3 "2018-09-27T18:04:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [September 27, 2018, 6:07pm UTC](https://discuss.elastic.co/t/what-to-put-in-logstash-config-if-ther-is-null-for-lat-long/149600/4 "2018-09-27T18:07:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Gosforth](https://avatars.discourse-cdn.com/v4/letter/g/f08c70/32.png) [@Gosforth](https://discuss.elastic.co/u/Gosforth)\
**Post date:** [September 27, 2018, 6:12pm UTC](https://discuss.elastic.co/t/what-to-put-in-logstash-config-if-ther-is-null-for-lat-long/149600/5 "2018-09-27T18:12:19Z")

</div>

Javascript works in config? Any example?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [September 27, 2018, 6:23pm UTC](https://discuss.elastic.co/t/what-to-put-in-logstash-config-if-ther-is-null-for-lat-long/149600/6 "2018-09-27T18:23:10Z")

</div>

Use standard [conditionals](https://www.elastic.co/guide/en/logstash/6.4/event-dependent-configuration.html).

---

<div class="post-metadata">

**Author:** ![Gosforth](https://avatars.discourse-cdn.com/v4/letter/g/f08c70/32.png) [@Gosforth](https://discuss.elastic.co/u/Gosforth)\
**Post date:** [October 8, 2018, 7:16pm UTC](https://discuss.elastic.co/t/what-to-put-in-logstash-config-if-ther-is-null-for-lat-long/149600/7 "2018-10-08T19:16:06Z")

</div>

```
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

---

<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:** [November 5, 2018, 7:18pm UTC](https://discuss.elastic.co/t/what-to-put-in-logstash-config-if-ther-is-null-for-lat-long/149600/8 "2018-11-05T19:18:19Z")

</div>

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