Unexpected character ('<' (code 60))


(Kyle ) #1

Hi, I'm new to using elasticsearch/logstash and I am trying to trouble shoot an error (this is also my first post here so apologies if I miss something.

I have created a logstash_test.config file:

    > input {
    >   file {
    >     path => "C:/Users/Documents/data/test.csv"
    >     start_position => "beginning"
    >     sincedb_path => "/dev/null"
    >   }
    > }
    > filter {
    >   csv {
    >     separator => ","
    >     columns => ["failure_code", "problem_desc"]
    >   }
    >   mutate {convert => ["failure_code", "string"]}
    >   mutate {convert => ["problem_desc", "string"]}
    > }
    > output {
    >   elasticsearch {
    >     hosts => "http://localhost:5601"
    >     index => "test"
    >     document_type => "description"
    >   }
    >   stdout {}
    > }

When I run '''bin/logstash ../data/logstash_test.config''' I get the following output:

Added in separate post

My .csv file is very basic and only contains two string columns. There are no '<' in the data anywhere and would love some help understanding what's causing this error. Thanks! :slight_smile:


(Kyle ) #2

Error log

[2018-07-02T13:57:20,424][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2018-07-02T13:57:20,886][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"6.3.0"}
[2018-07-02T13:57:22,942][WARN ][logstash.outputs.elasticsearch] You are using a deprecated config setting "document_type" set in elasticsearch. Deprecated settings will continue to work, but are scheduled for removal from logstash in the future. Document types are being deprecated in Elasticsearch 6.0, and removed entirely in 7.0. You should avoid this feature If you have any questions about this, please visit the #logstash channel on freenode irc. {:name=>"document_type", :plugin=><LogStash::Outputs::ElasticSearch hosts=>[http://localhost:5601], index=>"pal", document_type=>"description", id=>"26578f68b4c2dfe576d0cf98c17ba77fb410a76d4c84a291697ed77396726829", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_290c664e-7ae1-434b-87e3-e2a7ab5c4a6c", enable_metric=>true, charset=>"UTF-8">, workers=>1, manage_template=>true, template_name=>"logstash", template_overwrite=>false, doc_as_upsert=>false, script_type=>"inline", script_lang=>"painless", script_var_name=>"event", scripted_upsert=>false, retry_initial_interval=>2, retry_max_interval=>64, retry_on_conflict=>1, action=>"index", ssl_certificate_verification=>true, sniffing=>false, sniffing_delay=>5, timeout=>60, pool_max=>1000, pool_max_per_route=>100, resurrect_delay=>5, validate_after_inactivity=>10000, http_compression=>false>}
[2018-07-02T13:57:24,824][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>8, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
[2018-07-02T13:57:25,245][INFO ][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://localhost:5601/]}}
[2018-07-02T13:57:25,253][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://localhost:5601/, :path=>"/"}
[2018-07-02T13:57:25,415][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=>"http://localhost:5601/"}
[2018-07-02T13:57:25,480][ERROR][logstash.pipeline        ] Error registering plugin {:pipeline_id=>"main", :plugin=>"#<LogStash::OutputDelegator:0x68750190>", :error=>"Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: (byte[])\"<script>var hashRoute = '/app/kibana';\nvar defaultRoute = '/app/kibana';\n\nvar hash = window.location.hash;\nif (hash.length) {\n  window.location = hashRoute + hash;\n} else {\n  window.location = defaultRoute;\n}</script>\"; line: 1, column: 2]", :thread=>"#<Thread:0xc088756 run>"}
[2018-07-02T13:57:25,492][ERROR][logstash.pipeline        ] Pipeline aborted due to error {:pipeline_id=>"main", :exception=>#<LogStash::Json::ParserError: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: (byte[])"<script>var hashRoute = '/app/kibana';
var defaultRoute = '/app/kibana';

var hash = window.location.hash;
if (hash.length) {
  window.location = hashRoute + hash;
} else {
  window.location = defaultRoute;
}</script>"; line: 1, column: 2]>, :backtrace=>["C:/Users/Documents/logstash/logstash-core/lib/logstash/json.rb:17:in `jruby_load'", "C:/Users/Documents/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:447:in `get_es_version'", "C:/Users/Documents/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:249:in `block in healthcheck!'", "org/jruby/RubyHash.java:1343:in `each'", "C:/Users/Documents/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:241:in `healthcheck!'", "C:/Users/Documents/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:341:in `update_urls'", "C:/Users/Documents/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:71:in `start'", "C:/Users/Documents/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/http_client.rb:299:in `build_pool'", "C:/Users/Documents/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/http_client.rb:63:in `initialize'", "C:/Users/Documents/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/http_client_builder.rb:102:in `create_http_client'", "C:/Users/Documents/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/http_client_builder.rb:98:in `build'", "C:/Users/Documents/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch.rb:231:in `build_client'", "C:/Users/Documents/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/common.rb:24:in `register'", "org/logstash/config/ir/compiler/OutputStrategyExt.java:97:in `register'", "org/logstash/config/ir/compiler/OutputDelegatorExt.java:93:in `register'", "C:/Users/Documents/logstash/logstash-core/lib/logstash/pipeline.rb:340:in `register_plugin'", "C:/Users/Documents/logstash/logstash-core/lib/logstash/pipeline.rb:351:in `block in register_plugins'", "org/jruby/RubyArray.java:1734:in `each'", "C:/Users/Documents/logstash/logstash-core/lib/logstash/pipeline.rb:351:in `register_plugins'", "C:/Users/Documents/logstash/logstash-core/lib/logstash/pipeline.rb:728:in `maybe_setup_out_plugins'", "C:/Users/Documents/logstash/logstash-core/lib/logstash/pipeline.rb:361:in `start_workers'", "C:/Users/Documents/logstash/logstash-core/lib/logstash/pipeline.rb:288:in `run'", "C:/Users/Documents/logstash/logstash-core/lib/logstash/pipeline.rb:248:in `block in start'"], :thread=>"#<Thread:0xc088756 run>"}
[2018-07-02T13:57:25,516][ERROR][logstash.agent           ] Failed to execute action {:id=>:main, :action_type=>LogStash::ConvergeResult::FailedAction, :message=>"Could not execute action: PipelineAction::Create<main>, action_result: false", :backtrace=>nil}
[2018-07-02T13:57:25,834][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}```

#3

Really? Are you sure that should be 5601 rather than 9200? It looks to me like it is connecting to kibana (and getting that HTML back) when it should be talking to elasticsearch.


(Kyle ) #4

This was exactly the issue, thanks! Changed hosts => "http://localhost:5601" to just hosts => "localhost"


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.