# Make extracted field visible to all events

**URL:** <https://discuss.elastic.co/t/make-extracted-field-visible-to-all-events/94845>\
**Category:** Logstash\
**Created:** [July 27, 2017, 6:04pm UTC](https://discuss.elastic.co/t/make-extracted-field-visible-to-all-events/94845 "2017-07-27T18:04:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibrahimsharaf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ibrahimsharaf/32/17304_2.png) [@ibrahimsharaf](https://discuss.elastic.co/u/ibrahimsharaf)\
**Post date:** [July 27, 2017, 6:04pm UTC](https://discuss.elastic.co/t/make-extracted-field-visible-to-all-events/94845/1 "2017-07-27T18:04:22Z")

</div>

Hello, I've the following filter configurations

```
filter{
    if "Dumping Scrapy stats" in [message] {

    		grok{
    				match => ["message", "'item_scraped_count': %{NUMBER:scraped:int}"]
    		}
    		grok{
    				match => ["message", "'invalid_items_count': %{NUMBER:invalid:int}"]
    		}
    	
    	}

    	 else {
    		grok{
    				match => ["message", "Crawled iteration for merchant %{WORD:merchant_name} started"]
    			}
    		}
}
output {
    	if "_grokparsefailure" not in [tags]{
    		stdout {
    			codec => rubydebug
    		}

    		elasticsearch {
    			hosts => "elasticsearch:9200"
    			index => "logstash-%{merchant_name}"
    		}
    	}
    }

```

The log line that triggers the grok in the else part, comes before the one that triggeres the if part in the logfile, so after parsing the logfile, I get 2 elasticsearch indices logstash-adidas & logstash-%{merchant\_name}, I want the merchant\_name field to be (global?) once it is extracted.

How can I solve this problem?

---

<div class="post-metadata">

**Author:** ![CDR](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@CDR](https://discuss.elastic.co/u/CDR)\
**Post date:** [August 3, 2017, 2:53pm UTC](https://discuss.elastic.co/t/make-extracted-field-visible-to-all-events/94845/2 "2017-08-03T14:53:41Z")

</div>

Take a look at [this](https://www.elastic.co/guide/en/logstash/current/plugins-filters-environment.html) and see if that helps/solves your problem

---

<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:** [August 31, 2017, 2:53pm UTC](https://discuss.elastic.co/t/make-extracted-field-visible-to-all-events/94845/3 "2017-08-31T14:53:46Z")

</div>

Closed on August 31, 2017, 2:53pm UTC

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