# I am unable to use logstash to load csv files to elastic search

**URL:** https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496
**Category:** Logstash
**Created:** [December 5, 2018, 9:23am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496 "2018-12-05T09:23:15Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![lungelo\_zondo](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@lungelo\_zondo](https://discuss.elastic.co/u/lungelo_zondo)
#### Post date: [December 5, 2018, 9:23am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/1 "2018-12-05T09:23:15Z")

</div>

I get this on CMD but no data can be seen on elastic search.

!image|689x305

C:\Users\zondol\logstash-6.5.1\bin\>logstash -f /Users/zondol/data/logstash.config  
Sending Logstash logs to C:/Users/zondol/logstash-6.5.1/logs which is now configured via log4j2.properties  
[2018-12-05T10:57:47,336][WARN][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified  
[2018-12-05T10:57:47,376][INFO][logstash.runner] Starting Logstash {"logstash.version"=\>"6.5.1"}  
[2018-12-05T10:57:51,910][WARN][logstash.outputs.elasticsearch] You are using a deprecated config setting "document\_type" set in elasticsearch. Deprecated settings will continue to work, but are scheduled for removal from logstash in the future. Document types are being deprecated in Elasticsearch 6.0, and removed entirely in 7.0. You should avoid this feature If you have any questions about this, please visit the #logstash channel on freenode irc. {:name=\>"document\_type", :plugin=\>\<LogStash::Outputs::ElasticSearch index=\>"originId", id=\>"8a6346c13634a5b1aaa45ade0aaac38f25c357c32deb97891c8c98e50ee5ee1e", hosts=\>[[//localhost:9200](https://localhost:9200)], document\_type=\>"output\_input\_log", enable\_metric=\>true, codec=\>\<LogStash::Codecs::Plain id=\>"plain\_899f2dec-e50a-412a-8222-84d07db3c047", enable\_metric=\>true, charset=\>"UTF-8"\>, workers=\>1, manage\_template=\>true, template\_name=\>"logstash", template\_overwrite=\>false, doc\_as\_upsert=\>false, script\_type=\>"inline", script\_lang=\>"painless", script\_var\_name=\>"event", scripted\_upsert=\>false, retry\_initial\_interval=\>2, retry\_max\_interval=\>64, retry\_on\_conflict=\>1, action=\>"index", ssl\_certificate\_verification=\>true, sniffing=\>false, sniffing\_delay=\>5, timeout=\>60, pool\_max=\>1000, pool\_max\_per\_route=\>100, resurrect\_delay=\>5, validate\_after\_inactivity=\>10000, http\_compression=\>false\>}  
[2018-12-05T10:57:54,340][INFO][logstash.pipeline] Starting pipeline {:pipeline\_id=\>"main", "pipeline.workers"=\>4, "pipeline.batch.size"=\>125, "pipeline.batch.delay"=\>50}  
[2018-12-05T10:57:55,006][INFO][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=\>{:removed=\>, :added=\>[[http://localhost:9200/](http://localhost:9200/)]}}  
[2018-12-05T10:57:55,024][INFO][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck\_url=\>[http://localhost:9200/](http://localhost:9200/), :path=\>"/"}  
[2018-12-05T10:57:55,331][WARN][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=\>"[http://localhost:9200/](http://localhost:9200/)"}  
[2018-12-05T10:57:55,422][INFO][logstash.outputs.elasticsearch] ES Output version determined {:es\_version=\>6}  
[2018-12-05T10:57:55,429][WARN][logstash.outputs.elasticsearch] Detected a 6.x and above cluster: the `type` event field won't be used to determine the document \_type {:es\_version=\>6}  
[2018-12-05T10:57:55,472][INFO][logstash.outputs.elasticsearch] New Elasticsearch output {:class=\>"LogStash::Outputs::ElasticSearch", :hosts=\>["[//localhost:9200](https://localhost:9200)"]}  
[2018-12-05T10:57:55,496][INFO][logstash.outputs.elasticsearch] Using mapping template from {:path=\>nil}  
[2018-12-05T10:57:55,526][INFO][logstash.outputs.elasticsearch] Attempting to install template {:manage\_template=\>{"template"=\>"logstash-_", "version"=\>60001, "settings"=\>{"index.refresh\_interval"=\>"5s"}, "mappings"=\>{"default"=\>{"dynamic\_templates"=\>[{"message\_field"=\>{"path\_match"=\>"message", "match\_mapping\_type"=\>"string", "mapping"=\>{"type"=\>"text", "norms"=\>false}}}, {"string\_fields"=\>{"match"=\>"_", "match\_mapping\_type"=\>"string", "mapping"=\>{"type"=\>"text", "norms"=\>false, "fields"=\>{"keyword"=\>{"type"=\>"keyword", "ignore\_above"=\>256}}}}}], "properties"=\>{"@timestamp"=\>{"type"=\>"date"}, "@version"=\>{"type"=\>"keyword"}, "geoip"=\>{"dynamic"=\>true, "properties"=\>{"ip"=\>{"type"=\>"ip"}, "location"=\>{"type"=\>"geo\_point"}, "latitude"=\>{"type"=\>"half\_float"}, "longitude"=\>{"type"=\>"half\_float"}}}}}}}}  
[2018-12-05T10:57:56,419][INFO][logstash.pipeline] Pipeline started successfully {:pipeline\_id=\>"main", :thread=\>"#\<Thread:0x69afc614 run\>"}  
[2018-12-05T10:57:56,525][INFO][logstash.agent] Pipelines running {:count=\>1, :running\_pipelines=\>[:main], :non\_running\_pipelines=\>}  
[2018-12-05T10:57:56,537][INFO][filewatch.observingtail] START, creating Discoverer, Watch with file and sincedb collections  
[2018-12-05T10:57:57,078][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=\>9600}

---

<div class="post-metadata">

### Author: ![balumurari1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/balumurari1/32/39203_2.png) [@balumurari1](https://discuss.elastic.co/u/balumurari1)
#### Post date: [December 5, 2018, 9:27am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/2 "2018-12-05T09:27:30Z")

</div>

hello,  
if you could provide the input code it will be easy to provide the solution for you.

Regards.

---

<div class="post-metadata">

### Author: ![lungelo\_zondo](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@lungelo\_zondo](https://discuss.elastic.co/u/lungelo_zondo)
#### Post date: [December 5, 2018, 9:28am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/3 "2018-12-05T09:28:29Z")

</div>

Hi balumari1,

Thanks for replying, please see below.

input {  
file {  
path =\> "C:/Users/zondol/data/log\_file.csv"  
start\_position =\> "beginning"  
sincedb\_path =\> "nul"

```
}

```

}

filter {

```
    csv {

       separator => ","

       columns => ["originId","userId ","queryType","neStream ","neManager","neId","subscriberId","subscriberIdType"]
    }   

```

}

output {

```
elasticsearch{

 hosts => ["localhost:9200"]
 index => "originId"
 document_type => "output_input_log"
}

stdout {}

```

}

---

<div class="post-metadata">

### Author: ![balumurari1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/balumurari1/32/39203_2.png) [@balumurari1](https://discuss.elastic.co/u/balumurari1)
#### Post date: [December 5, 2018, 9:31am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/4 "2018-12-05T09:31:03Z")

</div>

in filter section remove the spaces for the field for "userId ","neStream " as shown below

columns =\> ["originId","userId ","queryType","neStream ","neManager","neId","subscriberId","subscriberIdType"]

to

columns =\> ["originId","userId","queryType","neStream","neManager","neId","subscriberId","subscriberIdType"]

---

<div class="post-metadata">

### Author: ![saeed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/saeed/32/38500_2.png) [@saeed](https://discuss.elastic.co/u/saeed)
#### Post date: [December 5, 2018, 9:32am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/5 "2018-12-05T09:32:19Z")

</div>

> [@lungelo\_zondo](#):
>
> hosts =\> ["localhost:9200"]

Hi  
I had same problem and changed host:  
hosts =\> ["localhost:9200"]  
to this:  
hosts =\> "localhost"  
My load was successful.  
Maybe it works for you too.

---

<div class="post-metadata">

### Author: ![balumurari1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/balumurari1/32/39203_2.png) [@balumurari1](https://discuss.elastic.co/u/balumurari1)
#### Post date: [December 5, 2018, 9:33am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/6 "2018-12-05T09:33:27Z")

</div>

here is sample example,

input {  
file {  
path =\> "D:/Balu/ELK-stack/csvfile.csv"  
start\_position =\> "beginning"  
sincedb\_path =\> "NUL"  
}  
}  
filter {  
csv {  
separator =\> ","  
columns =\> ["open","high","low","close","volume"]  
}  
}  
output {  
elasticsearch {  
hosts =\> "[http://localhost:9200](http://localhost:9200/)"  
index =\> "wallet-address-index"  
}  
stdout { codec =\> rubydebug }  
}

---

<div class="post-metadata">

### Author: ![lungelo\_zondo](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@lungelo\_zondo](https://discuss.elastic.co/u/lungelo_zondo)
#### Post date: [December 5, 2018, 11:36am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/7 "2018-12-05T11:36:09Z")

</div>

Thanks guys , I have tried all but still getting this below

C:\Users\zondol\logstash-6.5.1\bin\>logstash -f /Users/zondol/data/logstash.config  
Sending Logstash logs to C:/Users/zondol/logstash-6.5.1/logs which is now configured via log4j2.properties  
[2018-12-05T13:32:30,808][WARN][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified  
[2018-12-05T13:32:30,836][INFO][logstash.runner] Starting Logstash {"logstash.version"=\>"6.5.1"}  
[2018-12-05T13:32:36,491][WARN][logstash.outputs.elasticsearch] You are using a deprecated config setting "document\_type" set in elasticsearch. Deprecated settings will continue to work, but are scheduled for removal from logstash in the future. Document types are being deprecated in Elasticsearch 6.0, and removed entirely in 7.0. You should avoid this feature If you have any questions about this, please visit the #logstash channel on freenode irc. {:name=\>"document\_type", :plugin=\>\<LogStash::Outputs::ElasticSearch index=\>"originId", id=\>"8c0b3cc9c442b1b14c7c56239c7dec3b6991e95b8d32afffe061fb5c8309440c", hosts=\>[[http://localhost:9200](http://localhost:9200)], document\_type=\>"output\_input\_log", enable\_metric=\>true, codec=\>\<LogStash::Codecs::Plain id=\>"plain\_5756dfcb-24ed-42cf-b775-120e8d4a99dd", enable\_metric=\>true, charset=\>"UTF-8"\>, workers=\>1, manage\_template=\>true, template\_name=\>"logstash", template\_overwrite=\>false, doc\_as\_upsert=\>false, script\_type=\>"inline", script\_lang=\>"painless", script\_var\_name=\>"event", scripted\_upsert=\>false, retry\_initial\_interval=\>2, retry\_max\_interval=\>64, retry\_on\_conflict=\>1, action=\>"index", ssl\_certificate\_verification=\>true, sniffing=\>false, sniffing\_delay=\>5, timeout=\>60, pool\_max=\>1000, pool\_max\_per\_route=\>100, resurrect\_delay=\>5, validate\_after\_inactivity=\>10000, http\_compression=\>false\>}  
[2018-12-05T13:32:38,931][INFO][logstash.pipeline] Starting pipeline {:pipeline\_id=\>"main", "pipeline.workers"=\>4, "pipeline.batch.size"=\>125, "pipeline.batch.delay"=\>50}  
[2018-12-05T13:32:39,588][INFO][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=\>{:removed=\>, :added=\>[[http://localhost:9200/](http://localhost:9200/)]}}  
[2018-12-05T13:32:39,624][INFO][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck\_url=\>[http://localhost:9200/](http://localhost:9200/), :path=\>"/"}  
[2018-12-05T13:32:39,986][WARN][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=\>"[http://localhost:9200/](http://localhost:9200/)"}  
[2018-12-05T13:32:40,106][INFO][logstash.outputs.elasticsearch] ES Output version determined {:es\_version=\>6}  
[2018-12-05T13:32:40,124][WARN][logstash.outputs.elasticsearch] Detected a 6.x and above cluster: the `type` event field won't be used to determine the document \_type {:es\_version=\>6}  
[2018-12-05T13:32:40,169][INFO][logstash.outputs.elasticsearch] New Elasticsearch output {:class=\>"LogStash::Outputs::ElasticSearch", :hosts=\>["[http://localhost:9200](http://localhost:9200)"]}  
[2018-12-05T13:32:40,230][INFO][logstash.outputs.elasticsearch] Using mapping template from {:path=\>nil}  
[2018-12-05T13:32:40,296][INFO][logstash.outputs.elasticsearch] Attempting to install template {:manage\_template=\>{"template"=\>"logstash-_", "version"=\>60001, "settings"=\>{"index.refresh\_interval"=\>"5s"}, "mappings"=\>{"default"=\>{"dynamic\_templates"=\>[{"message\_field"=\>{"path\_match"=\>"message", "match\_mapping\_type"=\>"string", "mapping"=\>{"type"=\>"text", "norms"=\>false}}}, {"string\_fields"=\>{"match"=\>"_", "match\_mapping\_type"=\>"string", "mapping"=\>{"type"=\>"text", "norms"=\>false, "fields"=\>{"keyword"=\>{"type"=\>"keyword", "ignore\_above"=\>256}}}}}], "properties"=\>{"@timestamp"=\>{"type"=\>"date"}, "@version"=\>{"type"=\>"keyword"}, "geoip"=\>{"dynamic"=\>true, "properties"=\>{"ip"=\>{"type"=\>"ip"}, "location"=\>{"type"=\>"geo\_point"}, "latitude"=\>{"type"=\>"half\_float"}, "longitude"=\>{"type"=\>"half\_float"}}}}}}}}  
[2018-12-05T13:32:41,205][INFO][logstash.pipeline] Pipeline started successfully {:pipeline\_id=\>"main", :thread=\>"#\<Thread:0x27e5bb63 run\>"}  
[2018-12-05T13:32:41,308][INFO][logstash.agent] Pipelines running {:count=\>1, :running\_pipelines=\>[:main], :non\_running\_pipelines=\>}  
[2018-12-05T13:32:41,332][INFO][filewatch.observingtail] START, creating Discoverer, Watch with file and sincedb collections  
[2018-12-05T13:32:41,836][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=\>9600}

---

<div class="post-metadata">

### Author: ![saeed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/saeed/32/38500_2.png) [@saeed](https://discuss.elastic.co/u/saeed)
#### Post date: [December 5, 2018, 12:25pm UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/8 "2018-12-05T12:25:58Z")

</div>

This is my config file and it works:  
input {  
file {  
path =\> "C:/Data/booking/booking.csv"  
start\_position =\> "beginning"  
#sincedb\_path =\> "/dev/null"  
}  
}  
filter {  
csv {  
separator =\> "|"  
columns =\> ["hotelId","HotelName","City"]  
remove\_field =\> ["host", "message", "path", "@timestamp", "@version"]   
}  
}  
output {  
elasticsearch {  
hosts =\> "localhost"  
index =\> "booking"  
document\_type =\> "hotel"  
}  
stdout {}  
}

Maybe problem is logstash and elasticsearch version! I think they should have same version. If your versions is different, try same version!

---

<div class="post-metadata">

### Author: ![lungelo\_zondo](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@lungelo\_zondo](https://discuss.elastic.co/u/lungelo_zondo)
#### Post date: [December 5, 2018, 1:06pm UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/9 "2018-12-05T13:06:20Z")

</div>

Did you comment out **sincedb\_path**

---

<div class="post-metadata">

### Author: ![lungelo\_zondo](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@lungelo\_zondo](https://discuss.elastic.co/u/lungelo_zondo)
#### Post date: [December 5, 2018, 1:09pm UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/10 "2018-12-05T13:09:01Z")

</div>

The versions are the same , both 6.5.1

---

<div class="post-metadata">

### Author: ![saeed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/saeed/32/38500_2.png) [@saeed](https://discuss.elastic.co/u/saeed)
#### Post date: [December 6, 2018, 5:06am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/11 "2018-12-06T05:06:58Z")

</div>

Yes. And after that it works!!! I don't know why.

---

<div class="post-metadata">

### Author: ![saeed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/saeed/32/38500_2.png) [@saeed](https://discuss.elastic.co/u/saeed)
#### Post date: [December 6, 2018, 6:23am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/12 "2018-12-06T06:23:07Z")

</div>

I test it again and my load is fail now!!!  
But when unpack logstash.zip again and use it without plugins I installed before it works.  
Try this way, maybe that's it.

---

<div class="post-metadata">

### Author: ![lungelo\_zondo](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@lungelo\_zondo](https://discuss.elastic.co/u/lungelo_zondo)
#### Post date: [December 6, 2018, 7:27am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/13 "2018-12-06T07:27:43Z")

</div>

It doesn't work for me

---

<div class="post-metadata">

### Author: ![lungelo\_zondo](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@lungelo\_zondo](https://discuss.elastic.co/u/lungelo_zondo)
#### Post date: [December 6, 2018, 7:28am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/14 "2018-12-06T07:28:06Z")

</div>

I don't understand this part

---

<div class="post-metadata">

### Author: ![saeed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/saeed/32/38500_2.png) [@saeed](https://discuss.elastic.co/u/saeed)
#### Post date: [December 6, 2018, 8:06am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/15 "2018-12-06T08:06:23Z")

</div>

I removed old logstash folder, and downloaded logstash-6.5.1 again and used it.  
Try this way.

---

<div class="post-metadata">

### Author: ![lungelo\_zondo](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@lungelo\_zondo](https://discuss.elastic.co/u/lungelo_zondo)
#### Post date: [December 6, 2018, 8:09am UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/16 "2018-12-06T08:09:17Z")

</div>

let me try..thanks saed..you help is very appreciated

---

<div class="post-metadata">

### Author: ![lungelo\_zondo](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@lungelo\_zondo](https://discuss.elastic.co/u/lungelo_zondo)
#### Post date: [December 6, 2018, 1:27pm UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/17 "2018-12-06T13:27:03Z")

</div>

I got it right , I was saving my csv file as **filename**.csv so it couldn't recognize the file 🙂

---

<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: [January 3, 2019, 1:27pm UTC](https://discuss.elastic.co/t/i-am-unable-to-use-logstash-to-load-csv-files-to-elastic-search/159496/18 "2019-01-03T13:27:22Z")

</div>

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