# Add new field

**URL:** <https://discuss.elastic.co/t/add-new-field/89344>\
**Category:** Logstash\
**Created:** [June 14, 2017, 9:21am UTC](https://discuss.elastic.co/t/add-new-field/89344 "2017-06-14T09:21:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chemse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chemse/32/17956_2.png) [@Chemse](https://discuss.elastic.co/u/Chemse)\
**Post date:** [June 14, 2017, 9:21am UTC](https://discuss.elastic.co/t/add-new-field/89344/1 "2017-06-14T09:21:46Z")

</div>

Hello,  
I am parsing my data with logstash and I want to **add a new field** and I want to get it value from the first variable of a hash list called Tps wich I got it from a split of the message.

I've tried this line ut it doesn't work !!

`add-field => { "my_new_field" => "%{Tps[0]}" }`

this is my full filter

```
filter {
       if [type] == "1" {
             if "Tps:" in [message] {
                   csv {
                        separator => " Tps: "
                        columns => ["Mat","Tps"]
                    }
                   mutate {
                        split => { "Mat" => " " }
                        remove_field => ["Mat[0]","Mat[1]","Mat[1]","Mat[1]"]
                        split => { "Tps" => " " }
                        remove_field => ["Tps[1]","Tps[1]","Tps[1]"]
                        add-field => { "my_new_field"=> "%{Tps[0]}" }
                   }              
      }else { drop{} }
 }}

```

Can anyone help me please 🙂

---

<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:** [July 12, 2017, 9:22am UTC](https://discuss.elastic.co/t/add-new-field/89344/2 "2017-07-12T09:22:04Z")

</div>

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