Hello,
I have two windows maschines, one is a Windows Server and one is a Standard Windows Desktop PC, both have the same elasticsearch (8.4.3) and the same logstash (8.4.3) installed with the same configuration and the same pipelines, taking their data from the same Microsoft-SQL-Server.
I now try to query some NVARCHAR-Fields (which in MSSQL-Server is always encoded in UTF-16) via logstash-jdbc-input plugin without specifying any special encoding or charset settings, neither in the input nor in the output logstash plugins on both maschines.
On the windows server everything works perfectly and the documents are indexed to Elasticsearch as they should without errors. It doesn't make a difference whether logstash runs as a windows service via nssm or if I run it from the command line manually.
On the desktop pc on the other hand, I receive errors for every single document elasticsearch is trying to index stating that the encoding is incompatible. (again it's irrelevant if I run logstash manually from the commandline or as a windows service)
[2022-10-20T17:01:57,061][ERROR][logstash.outputs.elasticsearch][index_name][9648a8b8c103d11863b72d1b6d9624b2c3b8d672ae4baf73a17af87e6cc0c3e7]
An unknown error occurred sending a bulk request to Elasticsearch (will retry indefinitely) {:message=>"incompatible encodings: CP850 and UTF-8", :exception=>Encoding::CompatibilityError,
:backtrace=>[
"org/jruby/ext/stringio/StringIO.java:1162:in `write'",
"C:/Program Files/ElasticSearch/logstash/vendor/bundle/jruby/2.6.0/gems/logstash-output-elasticsearch-11.6.0-java/lib/logstash/outputs/elasticsearch/http_client.rb:142:in `block in bulk'",
"org/jruby/RubyArray.java:1865:in `each'",
"org/jruby/RubyEnumerable.java:1143:in `each_with_index'",
"C:/Program Files/ElasticSearch/logstash/vendor/bundle/jruby/2.6.0/gems/logstash-output-elasticsearch-11.6.0-java/lib/logstash/outputs/elasticsearch/http_client.rb:125:in `bulk'",
"C:/Program Files/ElasticSearch/logstash/vendor/bundle/jruby/2.6.0/gems/logstash-output-elasticsearch-11.6.0-java/lib/logstash/plugin_mixins/elasticsearch/common.rb:296:in `safe_bulk'",
"C:/Program Files/ElasticSearch/logstash/vendor/bundle/jruby/2.6.0/gems/logstash-output-elasticsearch-11.6.0-java/lib/logstash/plugin_mixins/elasticsearch/common.rb:228:in `submit'",
"C:/Program Files/ElasticSearch/logstash/vendor/bundle/jruby/2.6.0/gems/logstash-output-elasticsearch-11.6.0-java/lib/logstash/plugin_mixins/elasticsearch/common.rb:177:in `retrying_submit'",
"C:/Program Files/ElasticSearch/logstash/vendor/bundle/jruby/2.6.0/gems/logstash-output-elasticsearch-11.6.0-java/lib/logstash/outputs/elasticsearch.rb:342:in `multi_receive'",
"org/logstash/config/ir/compiler/AbstractOutputDelegatorExt.java:121:in `multi_receive'", "C:/Program Files/ElasticSearch/logstash/logstash-core/lib/logstash/java_pipeline.rb:300:in `block in start_workers'"]}
But now it gets really interesting, if I now call the "logstash.bat" on the windows desktop PC, from the commandline manually AND redirect the standard output (and/or) standard error to a text file on the disk, it WORKS perfectly and indexes everything as it should without errors.
How is there a difference in the internal encoding based on how the batch-file is called and also why does it work on the server no matter what?
Has anyone maybe encountered something similar in the past?
Thanks in advance for your help.
Simon