# Using request\_path to create output filter?

**URL:** <https://discuss.elastic.co/t/using-request-path-to-create-output-filter/126789>\
**Category:** Logstash\
**Created:** [April 4, 2018, 5:02pm UTC](https://discuss.elastic.co/t/using-request-path-to-create-output-filter/126789 "2018-04-04T17:02:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![titan1978](https://avatars.discourse-cdn.com/v4/letter/t/c37758/32.png) [@titan1978](https://discuss.elastic.co/u/titan1978)\
**Post date:** [April 4, 2018, 5:02pm UTC](https://discuss.elastic.co/t/using-request-path-to-create-output-filter/126789/1 "2018-04-04T17:02:05Z")

</div>

Hello,  
I'm using the following configuration to route request to my Elastic Instance. However, it looks like the **request\_path** header IF check is not passing and thus the **elasticsearch** instance is not being invoked. Can we not use the request headers to create such configurations?

`curl -H "content-type: application/json" -XPUT 'http://10.222.51.58:8080/aws-metrics' --data '@/C/Users/Temp/Desktop/my-file.json'`

```
output {
	stdout { 
		codec => rubydebug
	} 
    if[request_path] == "/aws-metrics" {
		elasticsearch {
			hosts => ["https://elasticsearch.myhost.com:443/"]
			index => "myapp-ls-%{+YYYY.MM.dd}"
			user => "elastic"
			password => "elastic"
		}
	}
}

```

**Logstash stdout**

```
{
....
"headers" => {
            "http_accept" => "*/*",
           "content_type" => "application/json",
           "request_path" => "/aws-metrics",
           "http_version" => "HTTP/1.1",
        "http_connection" => "Keep-Alive",
         "request_method" => "PUT",
              "http_host" => "10.222.51.58:8080",
            "request_uri" => "/aws-metrics",
         "content_length" => "3177",
            "http_expect" => "100-continue",
        "http_user_agent" => "curl/7.56.1"
    },
    "MyMetric" : "123",
    "MyMEtric2" : "1222".
    .....
}
```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 4, 2018, 5:09pm UTC](https://discuss.elastic.co/t/using-request-path-to-create-output-filter/126789/2 "2018-04-04T17:09:26Z")

</div>

> [@titan1978](#):
>
> if[request\_path] == "/aws-metrics" {

That should be

```auto
if [headers][request_path] == "/aws-metrics" {

```

---

<div class="post-metadata">

**Author:** ![titan1978](https://avatars.discourse-cdn.com/v4/letter/t/c37758/32.png) [@titan1978](https://discuss.elastic.co/u/titan1978)\
**Post date:** [April 4, 2018, 5:22pm UTC](https://discuss.elastic.co/t/using-request-path-to-create-output-filter/126789/3 "2018-04-04T17:22:03Z")

</div>

Perfect. 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:** [May 2, 2018, 5:22pm UTC](https://discuss.elastic.co/t/using-request-path-to-create-output-filter/126789/4 "2018-05-02T17:22:06Z")

</div>

Closed on May 2, 2018, 5:22pm UTC

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