How to transfer data to a host with a username and password

Hello dear friends. I have a problem. I have been helped by this website in many ways before. First of all, thank you very much for all the help for helping me improve myself on elasticsearch. :slight_smile: Current problem is that I want to transfer some data to a host with a username and password, but I keep getting the same error message. I would be very happy if you help. :slight_smile:

My conf file:

input { 
   file { 
      path => "........../*.txt"
      start_position => "beginning"
      sincedb_path => "NUL" 
   }
}
filter {
............. 
}
output {
    elasticsearch { 
      hosts => "xx.xx.xxx.xxx:xxxx" 
      manage_template => false 
      index => "my_index_name"
      document_type => "my_index_name" 
      user => "my_user_name"
      password => "my_password" 
    }

Error message:

[WARN ][logstash.outputs.elasticsearch][main] Attempted to resurrect connection to dead ES instance, but got an error {:url=>"http://elastic_user_name:xxxxxx@xx.xx.xxx.xxx:xxxx/", :exception=>LogStash::Outputs::Elasticsearch::HttpClient::Pool::BadResponseCodeError, :message=>"Got response code '403' contacting Elasticsearch at URL 'http://xx.xx.xxx.xxx:xxxx/'"}

I also made changes to logstash.yml and elasticsearch.yml files as follows, but I got the same error.

elasticsearch.yml:
xpack.management.elasticsearch.username: my_elastic_user_name
xpack.management.elasticsearch.password: my_password

logstash.yml:
xpack.monitoring.elasticsearch.username: my_elastic_user_name
xpack.monitoring.elasticsearch.password: my_password

Can you curl Elasticsearch using the username and password that you have in your Logstash config?

You should remove that, it's deprecated.

Ok i removed the document_type but i don't understand your this sentence:

Can you curl Elasticsearch using the username and password that you have in your 'ls config?

Can you check that the user name and password work directly with Elasticsearch?

I was able to connect to elasticsearch with the my custom port and host I wanted, but I was using localhost:5601 by default in kiban. Now i want to open kiban using its own host and port. I made some changes in kibana.yml file for this, but I can't access kibana. Can you help me about this problem?

My changes in kibana.yml file:

server.port: xxxx
server.host: "xx.xx.xxx.xxx"
server.name: "my_server_name"
elasticsearch.hosts: ["http://xx.xx.xxx.xxx:xxxx"]
elasticsearch.username: "my_user_name"
elasticsearch.password: "my_password"

@warkolm Maybe this problem can be solved by sending request from kibana to remote server but when i run this queries it also gave error.

GET https://xx.xx.xxx.xxx/my_index_name/_search
{
   "query": {
       "match_all": {}
    }
}

or

GET xx.xx.xxx.xxx/my_index_name/_search
{
   "query": {
       "match_all": {}
    }
}

Right, but unless you show those changes then there's pretty much nothing we can do except look at X's.

@warkolm I mean for example host:192.150.01.25 port:5625

I'm sorry you can't help me without telling me what the error is, you're right.

#! [types removal] Specifying types in search requests is deprecated.
{
  "error" : {
    "root_cause" : [
      {
        "type" : "index_not_found_exception",
        "reason" : "no such index [xx.xx.xxx.xxx]",
        "resource.type" : "index_or_alias",
        "resource.id" : "xx.xx.xxx.xxx",
        "index_uuid" : "_na_",
        "index" : "xx.xx.xxx.xxx"
      }
    ],
    "type" : "index_not_found_exception",
    "reason" : "no such index [xx.xx.xxx.xxx]",
    "resource.type" : "index_or_alias",
    "resource.id" : "xx.xx.xxx.xxx",
    "index_uuid" : "_na_",
    "index" : "xx.xx.xxx.xxx"
  },
  "status" : 404
}

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