# How to check if there is some specific field under fields

**URL:** <https://discuss.elastic.co/t/how-to-check-if-there-is-some-specific-field-under-fields/66201>\
**Category:** Logstash\
**Created:** [November 16, 2016, 5:35am UTC](https://discuss.elastic.co/t/how-to-check-if-there-is-some-specific-field-under-fields/66201 "2016-11-16T05:35:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)\
**Post date:** [November 16, 2016, 5:35am UTC](https://discuss.elastic.co/t/how-to-check-if-there-is-some-specific-field-under-fields/66201/1 "2016-11-16T05:35:11Z")

</div>

Hi,

I have a kafka input and sample data is something like;

```
{
  "@timestamp": "2016-11-16T05:26:16.137Z",
  "beat": {
    "hostname": "localhost",
    "name": "server",
    "version": "5.0.0"
  },
  "fields": {
    "logtype": "mylogs"
  },

```

I want to apply grok if mylogs, and I tried;

```
if[fields.logtype] == "mylogs"{
	grok {
	#do something
	}
}

```

But this is not working. What is the correct syntax for doing this? I mean, I want to apply grok if the field `logtype` under `fields` has value `mylogs`

Thanks.

---

<div class="post-metadata">

**Author:** ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)\
**Post date:** [November 16, 2016, 5:55am UTC](https://discuss.elastic.co/t/how-to-check-if-there-is-some-specific-field-under-fields/66201/2 "2016-11-16T05:55:50Z")

</div>

solved it using `[fields][logtype]`

---

<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:** [December 14, 2016, 5:56am UTC](https://discuss.elastic.co/t/how-to-check-if-there-is-some-specific-field-under-fields/66201/3 "2016-12-14T05:56:03Z")

</div>

Closed on December 14, 2016, 5:56am UTC

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