无效的配置 logstash 文件

Invalid config logstash file

我正在学习基本教程,因为我是新手,并且我有以下配置文件:

input {  
  file {
    path => "D:\elastic\logstash\data\data.csv"
    start_position => "beginning"    
  }
}
filter {  
  csv {
      separator => ","
      columns => ["Date","Open","High","Low","Close","Volume","Adj Close"]
  }
  mutate {convert => ["High", "float"]}
  mutate {convert => ["Open", "float"]}
  mutate {convert => ["Low", "float"]}
  mutate {convert => ["Close", "float"]}
  mutate {convert => ["Volume", "float"]}
}
output {  
    elasticsearch {
        action => "index"
        host => "localhost"
        index => "stock"
        workers => 1
    }
    stdout {}
}

然后我在终端中执行以下命令

bin\logstash -f logstash-simple.conf

它打印出这个:

io/console not supported; tty will not be manipulated
←[31mfetched an invalid config {:config=>"input {  \n  file {\n    path => \"D:\
\elastic\logstash\data\data.csv\"\n    start_position => \"beginning\"    \n
 }\n}\nfilter {  \n  csv {\n      separator => \",\"\n      columns => [\"Date\"......

文件的其余部分已解析。 我错过了什么? 它是 UTF-8 并尝试了 EOL UNIX 和 Windows 格式,但都失败了。

您需要像这样修改您的 file 输入:

  file {
    path => "D:\elastic\logstash\data\data.csv"
    start_position => "beginning"    
  }

或者像这样

  file {
    path => "D:/elastic/logstash/data/data.csv"
    start_position => "beginning"    
  }

同样在您的过滤器中,mutate/convert 中有拼写错误。它们应该是这样的(即将 => 替换为 =>):

  mutate {convert => ["High", "float"]}
  mutate {convert => ["Open", "float"]}
  mutate {convert => ["Low", "float"]}
  mutate {convert => ["Close", "float"]}
  mutate {convert => ["Volume", "float"]}