'how to pass certificate based authentication to CMRESHandler(Python Elasticsearch Log handler)

I am trying to connect to elastic search by providing certificate path and want to pass this path to CMRESHandler(Python Elasticsearch Log handler)

I created this class:

class ElasticSearchLogHandler(CMRESHandler):
    
    def __init__(self, *args, **kwargs):
        super(ElasticSearchLogHandler, self).__init__(*args, **kwargs)
        self.test_es_source()

instantiated a dictionary with this info:

params = dict(hosts=[{'host': ELASTIC_SEARCH_HOST, 'port': ELASTIC_SEARCH_PORT}],
                  use_ssl = False,
                                      auth_type=CMRESHandler.AuthType.BASIC_AUTH,
                                      auth_details=(ELASTIC_SEARCH_USER,ELASTIC_SEARCH_AUTHKEY),
                                      es_index_name=ELASTIC_SEARCH_INDEX,
                                      raise_on_indexing_exceptions=False,
                                      es_additional_fields=additional_fields,
                                      buffer_size=loggerBufSize,
                                      index_name_frequency=CMRESHandler.IndexNameFrequency.MONTHLY)

and finally instantiated the handler as follows: handler = ElasticSearchLogHandler(**params)

My question is how to pass the ca_certs file path?

Does the CMRESHandler library support creating elastic search with SSL enabled and how can i pass the certificate path?

Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source