# Ssl not working in elasticsearch input plugin

**URL:** <https://discuss.elastic.co/t/ssl-not-working-in-elasticsearch-input-plugin/263357>\
**Category:** Logstash\
**Created:** [February 5, 2021, 9:00am UTC](https://discuss.elastic.co/t/ssl-not-working-in-elasticsearch-input-plugin/263357 "2021-02-05T09:00:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ritusingh](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@ritusingh](https://discuss.elastic.co/u/ritusingh)\
**Post date:** [February 5, 2021, 9:00am UTC](https://discuss.elastic.co/t/ssl-not-working-in-elasticsearch-input-plugin/263357/1 "2021-02-05T09:00:45Z")

</div>

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

```auto
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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![ritusingh](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@ritusingh](https://discuss.elastic.co/u/ritusingh)\
**Post date:** [February 5, 2021, 10:13am UTC](https://discuss.elastic.co/t/ssl-not-working-in-elasticsearch-input-plugin/263357/2 "2021-02-05T10:13:59Z")

</div>

its resolved 🙂

here is the conf which worked for me:

```auto
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"
}

```

---

<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:** [March 5, 2021, 10:14am UTC](https://discuss.elastic.co/t/ssl-not-working-in-elasticsearch-input-plugin/263357/3 "2021-03-05T10:14:39Z")

</div>

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