Elsendion
Elsendion

Reputation: 187

Invalid config logstash file

I'm following a basic tutorial since i'm new in this, and i've the following config 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 {}
}

And then I execute the following command in the terminal

bin\logstash -f logstash-simple.conf

And it prints this:

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\"......

And the rest of the file parsed. What am I missing? It's in UTF-8 and tried EOL UNIX and Windows format with both failing.

Upvotes: 0

Views: 478

Answers (1)

Val
Val

Reputation: 217274

You need to modify your file input like this:

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

or like this

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

Also in your filters, there are typos in the mutate/convert. They should be like this (i.e. replace => by =>):

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

Upvotes: 1

Related Questions