@@ -26,6 +26,8 @@ namespace logs
2626 */
2727struct ElasticsearchExporterOptions
2828{
29+ using HttpHeaders = std::multimap<std::string, std::string>;
30+
2931 // Configuration options to establish Elasticsearch connection
3032 std::string host_;
3133 int port_;
@@ -37,6 +39,9 @@ struct ElasticsearchExporterOptions
3739 // Whether to print the status of the exporter in the console
3840 bool console_debug_;
3941
42+ /* * Additional HTTP headers. */
43+ HttpHeaders http_headers_;
44+
4045 /* *
4146 * Constructor for the ElasticsearchExporterOptions. By default, the endpoint is
4247 * localhost:9200/logs with a timeout of 30 seconds and disabled console debugging
@@ -47,16 +52,18 @@ struct ElasticsearchExporterOptions
4752 * from elasticsearch
4853 * @param console_debug If true, print the status of the exporter methods in the console
4954 */
50- ElasticsearchExporterOptions (std::string host = " localhost" ,
51- int port = 9200 ,
52- std::string index = " logs" ,
53- int response_timeout = 30 ,
54- bool console_debug = false )
55+ ElasticsearchExporterOptions (std::string host = " localhost" ,
56+ int port = 9200 ,
57+ std::string index = " logs" ,
58+ int response_timeout = 30 ,
59+ bool console_debug = false ,
60+ HttpHeaders http_headers = {})
5561 : host_{host},
5662 port_{port},
5763 index_{index},
5864 response_timeout_{response_timeout},
59- console_debug_{console_debug}
65+ console_debug_{console_debug},
66+ http_headers_{http_headers}
6067 {}
6168};
6269
0 commit comments