# Logstash add tag

**URL:** <https://discuss.elastic.co/t/logstash-add-tag/216917>\
**Category:** Logstash\
**Created:** [January 28, 2020, 9:26pm UTC](https://discuss.elastic.co/t/logstash-add-tag/216917 "2020-01-28T21:26:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![garcesdavid](https://avatars.discourse-cdn.com/v4/letter/g/35a633/32.png) [@garcesdavid](https://discuss.elastic.co/u/garcesdavid)\
**Post date:** [January 28, 2020, 9:26pm UTC](https://discuss.elastic.co/t/logstash-add-tag/216917/1 "2020-01-28T21:26:50Z")

</div>

Hello elastic forum  
I am learning some logstash concepts in [katacoda.com](http://katacoda.com) (actual company's mandatory trainings and I've choose logstash). I've completed a lot of 'hands-ons' so far.

The thing is that I reach a point where I don't understand what I should do on the following:

_Try adding tag A if the data read is a._

```auto
a
b
a
c
d

```

_Ensure that the input data is tagged with type as **test** , and write the output to the file **output.txt** in the path usr/share/logstash._

I've tried this but seems not help at all. lol

input {  
stdin {  
file {  
path =\> "/usr/share/logstash/lefile.txt"  
start\_position =\> "beginning"  
sincedb\_path =\> "/dev/null"  
tags =\> ["test"]  
}  
}  
}  
filter {  
if "test" in [tags] {  
grok {  
match =\> { "message" =\> "%{GREEDYDATA:letter}" }  
mutate { replace =\> { "letter" =\> "A" } }  
}  
}  
}  
output {  
file {  
message\_format =\> "%{[time]} | %{[severity]} : /%{[thread]}/ %{[loggername]} (%{[sourcemethodname]}) - %{[message]}"  
path =\> "/usr/share/logstash/output.txt"  
}  
}

Any advice would help me a lot. Thanks 🙂

---

<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:** [February 25, 2020, 9:26pm UTC](https://discuss.elastic.co/t/logstash-add-tag/216917/2 "2020-02-25T21:26:54Z")

</div>

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