Set an HTTP Proxy on Logstash’s Elasticsearch Output
Configure the Elasticsearch output plugin's proxy URI directly instead of relying on JVM-wide networking properties.
output {
elasticsearch {
id => "remote_cluster"
hosts => ["https://es.example:9200"]
proxy => "${ES_PROXY:}"
}
}
Merge this into the existing pipeline. hosts remains the cluster's HTTP endpoint, while the Logstash process's ES_PROXY can supply an approved URI such as http://proxy.example:8080.
The Elasticsearch output reference requires a proxy URI and explicitly accepts an empty string as unset. The expression's empty default lets this instance have no explicit proxy where none is required.
Preserve cluster authentication, index and TLS settings. A publicly reachable cluster can use an HTTP candidate from the HTTP proxy list only on a route that permits public intermediaries and has no proxy credentials configured; confirm access to the cluster’s actual host and port. Another output can choose another proxy without changing every Java HTTP client in the JVM.
Environment substitution happens while Logstash loads the pipeline. Set the variable on the actual service/container launch rather than in a later unrelated terminal.