# Error while importing CSV file with Logstash

**URL:** <https://discuss.elastic.co/t/error-while-importing-csv-file-with-logstash/174834>\
**Category:** Logstash\
**Created:** [April 1, 2019, 6:14pm UTC](https://discuss.elastic.co/t/error-while-importing-csv-file-with-logstash/174834 "2019-04-01T18:14:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![matheusribeirogarcia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matheusribeirogarcia/32/44363_2.png) [@matheusribeirogarcia](https://discuss.elastic.co/u/matheusribeirogarcia)\
**Post date:** [April 1, 2019, 6:14pm UTC](https://discuss.elastic.co/t/error-while-importing-csv-file-with-logstash/174834/1 "2019-04-01T18:14:46Z")

</div>

While it seems like my config file is right, it still doesn't run properly, accusing it of missing a #

I'm executing this command:  
`logstash -f C:\Users\CONSISTE\Desktop\logstash\dados\teste.config`

> message=\>"Expected one of #, input, filter, output at line 1, column 1 (byte 1) after ",

my config file:

```
input {
  file {
    path => "C:\Users\CONSISTE\Desktop\tabelas_cont\teste_csv.csv"
    start_position => "beginning"
    sincedb_path => "C:\Users\CONSISTE\Desktop\tabelas_cont\areas.log"
  }
}
filter {
  csv {
      columns => ["id","descricao","id_cli_area","instalacao_id","instancia_id","pagina_id","tipo_id"]
      separator => ","
  }
}
output {
   elasticsearch {
     hosts => "http://localhost:9200"
     index => "areas"
  }
stdout {}
}

```

I also created a CSV sample, just to check if there was a character coding error, but the same error occurred

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 1, 2019, 6:16pm UTC](https://discuss.elastic.co/t/error-while-importing-csv-file-with-logstash/174834/2 "2019-04-01T18:16:43Z")

</div>

Are you using -f to point to that specific file? If not, how are you telling logstash where to finds its configuration.

---

<div class="post-metadata">

**Author:** ![matheusribeirogarcia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matheusribeirogarcia/32/44363_2.png) [@matheusribeirogarcia](https://discuss.elastic.co/u/matheusribeirogarcia)\
**Post date:** [April 1, 2019, 6:18pm UTC](https://discuss.elastic.co/t/error-while-importing-csv-file-with-logstash/174834/3 "2019-04-01T18:18:31Z")

</div>

yes, i'm using that command:

`logstash -f C:\Users\CONSISTE\Desktop\logstash\dados\teste.config`

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 1, 2019, 6:23pm UTC](https://discuss.elastic.co/t/error-while-importing-csv-file-with-logstash/174834/4 "2019-04-01T18:23:28Z")

</div>

OK. logstash does not think that file starts with "input {". Can you run with "--log.level debug" and check the logstash.config.source.local.configpathloader message to make sure it is reading the right file. If it is then there could be a non-printing character at the start of the file. A BOM perhaps?

---

<div class="post-metadata">

**Author:** ![matheusribeirogarcia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matheusribeirogarcia/32/44363_2.png) [@matheusribeirogarcia](https://discuss.elastic.co/u/matheusribeirogarcia)\
**Post date:** [April 2, 2019, 12:52pm UTC](https://discuss.elastic.co/t/error-while-importing-csv-file-with-logstash/174834/5 "2019-04-02T12:52:36Z")

</div>

> [@matheusribeirogarcia](#):
>
> logstash -f C:\Users\CONSISTE\Desktop\logstash\dados\teste.config

Fixed it, changed the file to `UTF` without `BOM`, also, since I'm using Windows, I had to use "/" and not "" in `path` and` sincedb_path`, this way it worked.

Thanks for the help.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 30, 2019, 12:52pm UTC](https://discuss.elastic.co/t/error-while-importing-csv-file-with-logstash/174834/6 "2019-04-30T12:52:46Z")

</div>

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