Ssl not working in elasticsearch input plugin

Hi,
I am fetching logs from elasticsearch via logstash but if I use ssl I get the following error.

2056   error:
  2056     2056
  2056     Manticore::ClientProtocolException
  2056     PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Here is my conf:

input {
 elasticsearch {
     hosts => "https://localhost:9200"
	 user => "elastic"
	 password => "********"
	 ca_file => "C:/Users/M1056317/ELK/logstash-7.7.0/logstash-7.7.0/config/elastic-stack-ca.pem"
	index => "mergnginxinfo"
	schedule => "*/1 * * * *"
    query => '
    {
	    "query": {
			"bool": {
				"must": [
					{
					  "match_all": {}
					},
					{
					  "exists": {
						"field": "transaction.id.keyword"
					  }
					} ,
						{
						"range":{
						"@timestamp":
						{
							"gte": "now-2m", 
							"lte": "now-1m"
						}
						}
						}
						
				]
			
	  
	}
	
  },
	  "sort": [
				{
					"@timestamp": {
					 "order": "asc"
					}			
				}
  ]}'	
 } 
 
}







output {
	stdout { codec => rubydebug }
  csv {
    # elastic field name
    fields =>  ["@timestamp","requestid","ngnix.responsebytes"]
	
    # This is path where we store output.   
    path => "C:/Users/M1056317/ELK/csv/try6/csv-export-%{+YYYY-MM-dd_hh.mm}.csv"
	
	
	
	
  }
 
}




This conf file works very well when not using ssl. Please help.

This certificate also works well when used in output plugin.

its resolved :slightly_smiling_face:

here is the conf which worked for me:

elasticsearch {
     hosts => ["localhost:9200"]
     user => "elastic"
     password => "*********"
     ssl => true
     ca_file => "C:/Users/M1056317/ELK/logstash-7.7.0/logstash-7.7.0/config/elastic-stack-ca.pem"
    index => "mergnginxinfo"
}

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