# Logstash - Accessing Event Data and Fields in the Configuration - Conditionals

**URL:** https://discuss.elastic.co/t/logstash-accessing-event-data-and-fields-in-the-configuration-conditionals/120727
**Category:** Logstash
**Created:** [February 20, 2018, 9:38pm UTC](https://discuss.elastic.co/t/logstash-accessing-event-data-and-fields-in-the-configuration-conditionals/120727 "2018-02-20T21:38:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)
#### Post date: [February 20, 2018, 9:38pm UTC](https://discuss.elastic.co/t/logstash-accessing-event-data-and-fields-in-the-configuration-conditionals/120727/1 "2018-02-20T21:38:29Z")

</div>

I'm trying to follow [Accessing Event Data and Fields in the Configuration | Logstash Reference [6.2] | Elastic](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#conditionals) and I have a question:

output:

```
output {
  if [beats_input_raw_event] in [tags] or [beats_input_codec_plain_applied] in [tags] {
    ...

```

is there a way to configure "if tags exists" somehow? instead of specifying each tags?

Please advise.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [February 21, 2018, 5:54am UTC](https://discuss.elastic.co/t/logstash-accessing-event-data-and-fields-in-the-configuration-conditionals/120727/2 "2018-02-21T05:54:50Z")

</div>

> ```
> if [beats_input_raw_event] in [tags] or [beats_input_codec_plain_applied] in [tags] {
> 
> ```

That doesn't mean what you think it means. Do this instead:

```
 if "beats_input_raw_event" in [tags] or "beats_input_codec_plain_applied" in [tags] {

```

> is there a way to configure "if tags exists" somehow? instead of specifying each tags?

You mean "does the event have _any_ tags at all"? This should work:

```
if [tags] != [] {

```

---

<div class="post-metadata">

### Author: ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)
#### Post date: [February 21, 2018, 3:36pm UTC](https://discuss.elastic.co/t/logstash-accessing-event-data-and-fields-in-the-configuration-conditionals/120727/3 "2018-02-21T15:36:24Z")

</div>

I did like this:

```
if [tags] {

```

and it works)

---

<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: [March 21, 2018, 3:36pm UTC](https://discuss.elastic.co/t/logstash-accessing-event-data-and-fields-in-the-configuration-conditionals/120727/4 "2018-03-21T15:36:33Z")

</div>

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