# How to access the value in the logstash metadata

**URL:** <https://discuss.elastic.co/t/how-to-access-the-value-in-the-logstash-metadata/157200>\
**Category:** Logstash\
**Created:** [November 18, 2018, 1:59am UTC](https://discuss.elastic.co/t/how-to-access-the-value-in-the-logstash-metadata/157200 "2018-11-18T01:59:48Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [November 19, 2018, 7:29am UTC](https://discuss.elastic.co/t/how-to-access-the-value-in-the-logstash-metadata/157200/2 "2018-11-19T07:29:42Z")

</div>

Something like this?

```auto
input {
  generator {
    lines => ['message1']
    count => 1
    add_field => { "[@metadata][key]" => "test" }
  }
}

filter {
  if [@metadata][key] == "test" {
    mutate {
      add_tag => ["found"]
    }
  }
}

output {
  stdout { codec => rubydebug { metadata => true }}
}

```

---

_[View the full topic](https://discuss.elastic.co/t/how-to-access-the-value-in-the-logstash-metadata/157200)._
