Logstash Opensearch Configuration havin codec json

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):


Describe the issue:
I am using opensearch with logstash, I wanted to use codec => json in output section of opensearch configuration. How can I achieve that?


opensearch {
        hosts => ["${OPENSEARCH_HOSTS}"]
        index => "%{logplane}-%{+{{ $date_format }}}"
        http_compression => true
        {{- if $g.security.tls.enabled }}
        ssl => true
        cacert => "/run/secrets/sip-tls-trusted-root-cert/ca.crt"
        keystore => "/opt/logstash/resource/keystore.p12"
        keystore_password => "%%KEYSTORE_PASS%%"
        ssl_certificate_verification => true
        {{- end }}
        manage_template => false

Relevant Logs or Screenshots:

You shouldn’t have to use or specify the json codec output if using the opensearch output plugin, however if you want to print to stdout you can use the codec => json parameter.
Output plugins | Logstash Reference [8.7] | Elastic - would be the best place to find out which plugins you can use different codecs on.


I see you are using ssl_certificate_verification => true, and it’s working for you. Can you tell me whats your configuration at the opensearch side? I’m getting. the error that opensearch is not a match for alternative name…

Thank you!

@Gosia Would you mind creating a new thread and sharing the link here?
Please also share your Logstash output, the full error and exact versions of Logstash nad OpenSearch.