Search code examples
elasticsearchapache-kafkalogstash

logstash Expected one of [ \\t\\r\\n], \"#\", \"input\", \"filter\", \"output\" at line 1, column 1 (byte 1)",


I get an error at line 1 column one but I don't know what's happening.

I already tried some things I found in other posts:

  • Changing from utf-8 to utf-8 BOM to ANSI
  • Changing to Linux LF and
  • Windows CRLF retyping the whole file
  • I have checked in notepad++ (view -> show all characters) that there arent any other symbols
  • I even tried copying the example that logstash gives of a pipelines.yml

This is the pipelines.yml that Im using

-pipeline.id: KafkaES-process
 queue.type:persisted
 config.string: |
    input{ kafka{
    bootstrap_servers => "localhost:9092"
    topics => ["topic_es"]
    }
    }
    filter{
    json{
    source=> "message"
    }
    mutate{
    remove_field => "message"
    }
    }
    output{
    elasticsearch{
    hosts => ["localhost:9200"]
    index => "houses_index"
    }
    }

This is how I call it

C:/Users/user/Downloads/logstash-7.15.2/bin/logstash -f pipelines.yml

Any ideas/questions are welcomed.


Solution

  • You do not use -f to point to pipelines.yml, you use it to point to a file or directory that contains your pipeline configuration. You could take the value of config.string, put that if a file called my.conf, and then run logstash -f my.conf.

    The error message is complaining about the - which is the first character of the YAML.

    Put the pipelines.yml file in your path.settings directory and start logstash using

    C:/Users/user/Downloads/logstash-7.15.2/bin/logstash