# Logstash with Shield : Failed action with response of 404

**URL:** https://discuss.elastic.co/t/logstash-with-shield-failed-action-with-response-of-404/24113
**Category:** Logstash
**Created:** [June 22, 2015, 4:27pm UTC](https://discuss.elastic.co/t/logstash-with-shield-failed-action-with-response-of-404/24113 "2015-06-22T16:27:49Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![marjolaine](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@marjolaine](https://discuss.elastic.co/u/marjolaine)
#### Post date: [June 22, 2015, 4:27pm UTC](https://discuss.elastic.co/t/logstash-with-shield-failed-action-with-response-of-404/24113/1 "2015-06-22T16:27:49Z")

</div>

Hello,

I have installed Elasticsearsh 1.4.4, Shield 1.1.1, Logstash 1.5.1.  
I put this configuration for Logstash in /etc/logstash/conf.d/log.conf

```
input
{ 
    stdin {}
}
output {
    stdout { codec => rubydebug }
    elasticsearch {
	    user => "admin"
	    password => "password"
	    protocol => "http"    	
    }
}

```

But when I test it with the following command :

```
 /opt/logstash/bin/logstash -f /etc/logstash/conf.d/log.conf 

```

Logstash start correctly

```
Logstash startup completed

```

So I put a string "test", and this is my result

```
failed action with response of 404, dropping action: ["index", {:_id=>nil, :_index=>"logstash-2015.06.22", :_type=>"logs", :_routing=>nil}, #<LogStash::Event:0x7ac7c9cc @metadata={"retry_count"=>0}, @accessors=#<LogStash::Util::Accessors:0x5a7ba8d4 @store={"message"=>"test", "@version"=>"1", "@timestamp"=>"2015-06-22T15:53:13.376Z", "host"=>"slnxelknode01.simat.ntes.ext.sopra"}, @lut={"host"=>[{"message"=>"test", "@version"=>"1", "@timestamp"=>"2015-06-22T15:53:13.376Z", "host"=>"slnxelknode01.simat.ntes.ext.sopra"}, "host"], "type"=>[{"message"=>"test", "@version"=>"1", "@timestamp"=>"2015-06-22T15:53:13.376Z", "host"=>"slnxelknode01.simat.ntes.ext.sopra"}, "type"]}>, @data={"message"=>"test", "@version"=>"1", "@timestamp"=>"2015-06-22T15:53:13.376Z", "host"=>"slnxelknode01.simat.ntes.ext.sopra"}, @metadata_accessors=#<LogStash::Util::Accessors:0x3397a6be @store={"retry_count"=>0}, @lut={}>, @cancelled=false>] {:level=>:warn, :file=>"logstash/outputs/elasticsearch.rb", :line=>"478", :method=>"submit"}

```

No index created in Elasticsearch

I tried with --debug, but it doesn't help me to solve the problem

Any idea to help me ?

Thanks

---

<div class="post-metadata">

### Author: ![suyograo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suyograo/32/44898_2.png) [@suyograo](https://discuss.elastic.co/u/suyograo)
#### Post date: [June 23, 2015, 6:29am UTC](https://discuss.elastic.co/t/logstash-with-shield-failed-action-with-response-of-404/24113/2 "2015-06-23T06:29:19Z")

</div>

are you able to connect to the ES cluster using `curl` and basic auth? I would check that first to rule out any setup issues in ES Shield. If everything is fine with `curl` we can debug the LS side

---

<div class="post-metadata">

### Author: ![marjolaine](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@marjolaine](https://discuss.elastic.co/u/marjolaine)
#### Post date: [June 23, 2015, 7:23am UTC](https://discuss.elastic.co/t/logstash-with-shield-failed-action-with-response-of-404/24113/3 "2015-06-23T07:23:01Z")

</div>

I make the test with

```
curl -XGET 'http://localhost:9200/*?pretty' --user admin:password

```

I have no problem, all my index appear.  
So I haven't problem with Elasticsearch. It really Logstash which have problem

---

<div class="post-metadata">

### Author: ![marjolaine](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@marjolaine](https://discuss.elastic.co/u/marjolaine)
#### Post date: [June 23, 2015, 10:16am UTC](https://discuss.elastic.co/t/logstash-with-shield-failed-action-with-response-of-404/24113/4 "2015-06-23T10:16:57Z")

</div>

When I put --verbose I have those messages which appear.

```
Using version 0.1.x input plugin 'stdin'. This plugin isn't well supported by the community and likely has no maintainer. {:level=>:info}
    Using version 0.1.x codec plugin 'line'. This plugin isn't well supported by the community and likely has no maintainer. {:level=>:info}
    Using version 0.1.x output plugin 'stdout'. This plugin isn't well supported by the community and likely has no maintainer. {:level=>:info}
    Using version 0.1.x codec plugin 'rubydebug'. This plugin isn't well supported by the community and likely has no maintainer. {:level=>:info}
    Using version 0.1.x output plugin 'elasticsearch'. This plugin isn't well supported by the community and likely has no maintainer. {:level=>:info}
    Using version 0.1.x codec plugin 'plain'. This plugin isn't well supported by the community and likely has no maintainer. {:level=>:info}

```

Before I was in version 1.4.2 of logstash and I it was working, I install the version 1.5.1 with the rpm to be compatible with shield, but apparently the versions of logstash plugins are not updated.

Can it explain why I have the message "failed action with response of 404" ? How can I update those plugin (my server is not connect to internet)?

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [June 23, 2015, 11:04am UTC](https://discuss.elastic.co/t/logstash-with-shield-failed-action-with-response-of-404/24113/5 "2015-06-23T11:04:52Z")

</div>

You should ignore the "This plugin isn't well supported by the community" messages. It's unrelated to your 404 problem.

---

<div class="post-metadata">

### Author: ![marjolaine](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@marjolaine](https://discuss.elastic.co/u/marjolaine)
#### Post date: [June 24, 2015, 1:19pm UTC](https://discuss.elastic.co/t/logstash-with-shield-failed-action-with-response-of-404/24113/6 "2015-06-24T13:19:08Z")

</div>

I find why I have this message.  
In my config file of ES I have :

```
http.port: 9200

```

And in my config file of Logstash don't say the port in output elasticsearch. I used the default port. But in Logstash 1.5.1, the default port is not 9200. So I add in Logstash config :

```
elasticsearch {
    ...
    port => 9200
    ...
}

```

And now it works !

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [June 24, 2015, 1:52pm UTC](https://discuss.elastic.co/t/logstash-with-shield-failed-action-with-response-of-404/24113/7 "2015-06-24T13:52:05Z")

</div>

That's odd. According to [the documentation](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-port), port 9200 is the default with `protocol => http`. It sounds like either the documentation or the code is buggy.

---

<div class="post-metadata">

### Author: ![suyograo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suyograo/32/44898_2.png) [@suyograo](https://discuss.elastic.co/u/suyograo)
#### Post date: [June 26, 2015, 5:41am UTC](https://discuss.elastic.co/t/logstash-with-shield-failed-action-with-response-of-404/24113/8 "2015-06-26T05:41:09Z")

</div>

The default is indeed 9200 if you use http protocol. Can you stick your full ES config here (without the username/password)

---

<div class="post-metadata">

### Author: ![suyograo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suyograo/32/44898_2.png) [@suyograo](https://discuss.elastic.co/u/suyograo)
#### Post date: [June 26, 2015, 5:42am UTC](https://discuss.elastic.co/t/logstash-with-shield-failed-action-with-response-of-404/24113/9 "2015-06-26T05:42:03Z")

</div>

Ah never mind, I see your config on top. This is weird. So adding the port fixed the issue?

---

<div class="post-metadata">

### Author: ![marjolaine](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@marjolaine](https://discuss.elastic.co/u/marjolaine)
#### Post date: [June 26, 2015, 7:14am UTC](https://discuss.elastic.co/t/logstash-with-shield-failed-action-with-response-of-404/24113/10 "2015-06-26T07:14:02Z")

</div>

This is my complete ES configuration: elasticsearch.yml :

```
marvel.agent.exporter.es.hosts: ["username:password@slnxelknode01.simat.ntes.ext.sopra:9200"]

action.auto_create_index: .marvel-*

shield:
  authc:
    realms:
      realm_name:
        type: esusers
        files:
          users: /usr/share/elasticsearch/config/shield/users
          users_roles: /usr/share/elasticsearch/config/shield/users_roles

cluster.name: simat    

bootstrap.mlockall: true

http.port: 9200

```

I know it's weird, but when I add the port in my logastash conf, it works !

---

<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 6, 2017, 5:36am UTC](https://discuss.elastic.co/t/logstash-with-shield-failed-action-with-response-of-404/24113/11 "2017-07-06T05:36:22Z")

</div>


