# Check existence of a field and checking null value in field

**URL:** https://discuss.elastic.co/t/check-existence-of-a-field-and-checking-null-value-in-field/24968
**Category:** Logstash
**Created:** [July 6, 2015, 5:24pm UTC](https://discuss.elastic.co/t/check-existence-of-a-field-and-checking-null-value-in-field/24968 "2015-07-06T17:24:56Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![mbertani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mbertani/32/11398_2.png) [@mbertani](https://discuss.elastic.co/u/mbertani)
#### Post date: [April 5, 2016, 8:28pm UTC](https://discuss.elastic.co/t/check-existence-of-a-field-and-checking-null-value-in-field/24968/4 "2016-04-05T20:28:18Z")

</div>

Developing further the idea of using the ruby filter, can you try something like this?

````ruby
                    code => "
					if event['column16'] == nil
						event['log_type'] = 'type2'
					else
						event['log_type'] = 'type1'
					end					
			"
	}```
````

---

_[View the full topic](https://discuss.elastic.co/t/check-existence-of-a-field-and-checking-null-value-in-field/24968)._
