# Wrong logstash input filter invoked: csv filter is being invoked rather than http

**URL:** <https://discuss.elastic.co/t/wrong-logstash-input-filter-invoked-csv-filter-is-being-invoked-rather-than-http/244798>\
**Category:** Logstash\
**Created:** [August 13, 2020, 5:20am UTC](https://discuss.elastic.co/t/wrong-logstash-input-filter-invoked-csv-filter-is-being-invoked-rather-than-http/244798 "2020-08-13T05:20:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![david6](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david6/32/73787_2.png) [@david6](https://discuss.elastic.co/u/david6)\
**Post date:** [August 13, 2020, 5:20am UTC](https://discuss.elastic.co/t/wrong-logstash-input-filter-invoked-csv-filter-is-being-invoked-rather-than-http/244798/1 "2020-08-13T05:20:54Z")

</div>

When I PUT a json body to the configured http input url, the CSV filter is being invoked instead of http. What am I missing?  
PUT:

```auto
curl --header "Content-Type: application/json" \
--request PUT \
--data '{"field1": "manual"}' \
http://my.hostname.here:6060/uri

```

Error:

```auto
[logstash.filters.csv] Error parsing csv {:field=>"message", :source=>"", :exception=>#<NoMethodError: undefined method `each_index' for nil:NilClass>}

```

http-input plugin version: 3.3.0

Config:

```auto
    input {
        beats {
            port => 5044
         }
        http {
            host => "0.0.0.0"
            port => 6060
        }
}

filter {

    mutate {
        remove_field => ["[beat]", "[host][name]", "[input][type]", "[prospector]", "[temp]", "[host]", "[source]", "[agent]" ]
        remove_tag => ["beats_input_codec_plain_applied"]

    }

    http {
        url => "http://my.hostname.here:6060/uri"
    }

    csv {
        separator => ","
        skip_header => true
        skip_empty_columns => true
        columns => ["[col1]", "col2" ]
    }

}

```

---

<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:** [August 13, 2020, 2:58pm UTC](https://discuss.elastic.co/t/wrong-logstash-input-filter-invoked-csv-filter-is-being-invoked-rather-than-http/244798/2 "2020-08-13T14:58:52Z")

</div>

Your configuration unconditionally runs a mutate filter, then an http filter, then a csv filter.

When you post application/json into an http input it is parsed, and there is no [message] field added. The csv filter will try to parse the [message]. I would expect that to be a [no-op](https://github.com/logstash-plugins/logstash-filter-csv/blob/5e0529d32f4feda6cfd6d32a92512056b35cea65/lib/logstash/filters/csv.rb#L130), but I guess not.

---

<div class="post-metadata">

**Author:** ![david6](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david6/32/73787_2.png) [@david6](https://discuss.elastic.co/u/david6)\
**Post date:** [August 13, 2020, 3:11pm UTC](https://discuss.elastic.co/t/wrong-logstash-input-filter-invoked-csv-filter-is-being-invoked-rather-than-http/244798/3 "2020-08-13T15:11:13Z")

</div>

Oh I see. I thought that only that type of input would invoke the appropriate filter.

Thanks for pointing that out!

---

<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:** [September 10, 2020, 3:11pm UTC](https://discuss.elastic.co/t/wrong-logstash-input-filter-invoked-csv-filter-is-being-invoked-rather-than-http/244798/4 "2020-09-10T15:11:19Z")

</div>

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