# Using logstash to import csv files into elasticsearch

**URL:** https://discuss.elastic.co/t/using-logstash-to-import-csv-files-into-elasticsearch/104114
**Category:** Logstash
**Created:** [October 16, 2017, 3:57pm UTC](https://discuss.elastic.co/t/using-logstash-to-import-csv-files-into-elasticsearch/104114 "2017-10-16T15:57:17Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)
#### Post date: [October 16, 2017, 3:57pm UTC](https://discuss.elastic.co/t/using-logstash-to-import-csv-files-into-elasticsearch/104114/1 "2017-10-16T15:57:17Z")

</div>

I'm using [Running Logstash on Docker | Logstash Reference [5.6] | Elastic](https://www.elastic.co/guide/en/logstash/current/docker.html) to import _csv_ file into _elasticsearch_.

following is content from my _./pipeline_ directory:

```
input {
    file {
        path => "/csv/in/*.csv"
        start_position => "beginning"
        sincedb_path => "/dev/null"
    }
}

filter {
  csv {
    separator => ";"
    columns => ["bin", "cardNetwork", "bank", "cardType", "cardCategory", "country"]
  }
}

output {
  elasticsearch {
    hosts => "elasticsearch:9200"
    user => "USER"
    password => "PASSWORD"
    index => "INDEX"
    document_type => "csv"
  }
  stdout { codec => rubydebug }
}

```

I'm not seeing any "ERROR" even with 'log.level' set to 'debug', thanks to stdout part I'm able to see that csv parse correctly, yet I'm not seeing anything written to elasticsearch.

Please advise.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [October 16, 2017, 7:50pm UTC](https://discuss.elastic.co/t/using-logstash-to-import-csv-files-into-elasticsearch/104114/2 "2017-10-16T19:50:44Z")

</div>

> I'm not seeing anything written to elasticsearch.

What made you reach that conclusion? How are you checking what's in ES?

---

<div class="post-metadata">

### Author: ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)
#### Post date: [October 16, 2017, 9:00pm UTC](https://discuss.elastic.co/t/using-logstash-to-import-csv-files-into-elasticsearch/104114/3 "2017-10-16T21:00:09Z")

</div>

I checked using `Kibana` and/or `curl` for newly created \_index: `INDEX`, yet no records in there...

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [October 17, 2017, 5:20am UTC](https://discuss.elastic.co/t/using-logstash-to-import-csv-files-into-elasticsearch/104114/4 "2017-10-17T05:20:58Z")

</div>

I assume the index isn't really named INDEX? Because that would be an illegal name.

If the index exists then Logstash is at least able to talk to ES (unless you created the index yourself). If there really isn't anything in the log I'd trace the network traffic.

---

<div class="post-metadata">

### Author: ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)
#### Post date: [October 24, 2017, 4:42pm UTC](https://discuss.elastic.co/t/using-logstash-to-import-csv-files-into-elasticsearch/104114/5 "2017-10-24T16:42:23Z")

</div>

@magnusbaeck, you're correct INDEX isn't real...

... to test your theory, I adjusted output to write to index that doesn't exists followed by restart of container, and as last time I see stdout (rubydebug), however new index was not created nor my data would appear inside of it... I look in logs and there is no errors (or any issues) with connecting to elasticsearch, it appears to be connected just fine.

I'm also using X-Pack, and I see other connection to elasticsearch (for monitoring) are made without any issues...

Please advise.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [October 24, 2017, 6:21pm UTC](https://discuss.elastic.co/t/using-logstash-to-import-csv-files-into-elasticsearch/104114/6 "2017-10-24T18:21:53Z")

</div>

As I said, I'd trace the network traffic so see exactly what's going on.

---

<div class="post-metadata">

### Author: ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)
#### Post date: [October 25, 2017, 1:29am UTC](https://discuss.elastic.co/t/using-logstash-to-import-csv-files-into-elasticsearch/104114/7 "2017-10-25T01:29:40Z")

</div>

@magnusbaeck, I'm on same network as elasticsearch, network isn't preventing any communications as I mention X-Pack's monitoring part is working without any issues and it's using same elasticsearch as I specified in my output plugin.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [October 25, 2017, 5:18am UTC](https://discuss.elastic.co/t/using-logstash-to-import-csv-files-into-elasticsearch/104114/8 "2017-10-25T05:18:04Z")

</div>

The point of inspecting the network traffic is to see whether Logstash is attempting to send anything to ES, and if so what and what ES responds. Any errors response should show up in the Logstash log but other breakage could prevent that from happening.

---

<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: [November 22, 2017, 5:18am UTC](https://discuss.elastic.co/t/using-logstash-to-import-csv-files-into-elasticsearch/104114/9 "2017-11-22T05:18:24Z")

</div>

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