# Please help Importing csv with logstash and create an index in elasticsearch

**URL:** <https://discuss.elastic.co/t/please-help-importing-csv-with-logstash-and-create-an-index-in-elasticsearch/83689>\
**Category:** Logstash\
**Created:** [April 26, 2017, 11:46am UTC](https://discuss.elastic.co/t/please-help-importing-csv-with-logstash-and-create-an-index-in-elasticsearch/83689 "2017-04-26T11:46:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alvaro\_Sanz\_Garrigue](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Alvaro\_Sanz\_Garrigue](https://discuss.elastic.co/u/Alvaro_Sanz_Garrigue)\
**Post date:** [April 26, 2017, 11:46am UTC](https://discuss.elastic.co/t/please-help-importing-csv-with-logstash-and-create-an-index-in-elasticsearch/83689/1 "2017-04-26T11:46:15Z")

</div>

Hello,  
I'm new with elasticsearch and I'm trying to import csv data with logstash in Windows 10.

The configuration file i'm using for logstash is "csv-config.conf":

> input {  
> file {  
> path =\> "/Users/asanzgarrigues/Desktop/test2.csv"  
> start\_position =\> "beginning"  
> }  
> }  
> filter {  
> csv {  
> separator =\> ","  
> columns =\> ["PacketId","MACAddress","Date","PacketLength","SourceIP","SourcePort","DestIP","DestPort"]  
> }  
> }  
> output {  
> elasticsearch {  
> hosts =\> ["localhost:9203"]  
> action =\> "index"  
> index =\> "test"  
> }  
> stdout {codec =\> rubydebug}  
> }

When I execute the command:  
`logstash -f csv-config.conf`

the response is the following:

 ![](https://us1.discourse-cdn.com/elastic/original/3X/5/5/5562778cdf43115d5f68048b857f271f8555f02e.png)  
It looks like the index have been created(or at least I think so) but when I search for my index with kibana or elasticsearch nothing appears.  
 ![](https://us1.discourse-cdn.com/elastic/original/3X/a/1/a1e8fdf29bbd1a0220ed82915e272c54943901ad.png)

 ![](https://us1.discourse-cdn.com/elastic/original/3X/a/d/ad59edd01dd5742cc936ecda663f80691e3470c5.png)

I changed the elasticsearch port to 9203 because 9200 was not working.  
Additonaly, the file log4j2 is located in the correct path but logstash doesn't recognize it.  
Edit: I solved the problem of log4j2, the problem was in the file runner.rb (logstash-5.3.0\logstash-core\lib\logstash\runner.rb) at the line:  
`LogStash::Logging::Logger::initialize("file://" + log4j_config_location)`  
that line should be replaced by:  
` LogStash::Logging::Logger::initialize("file:///" + log4j_config_location)`

I also try to use the debug mode to get more information about the problem but I don't get nothing clear.

Thnak you for help!

---

<div class="post-metadata">

**Author:** ![Alvaro\_Sanz\_Garrigue](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Alvaro\_Sanz\_Garrigue](https://discuss.elastic.co/u/Alvaro_Sanz_Garrigue)\
**Post date:** [April 27, 2017, 7:04am UTC](https://discuss.elastic.co/t/please-help-importing-csv-with-logstash-and-create-an-index-in-elasticsearch/83689/2 "2017-04-27T07:04:30Z")

</div>

Researching I think that the problem is the connection between ES and logstash. Because I have the following WARN in the console response.

> [2017-04-26T18:37:13,307][WARN][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=\>#URI::HTTP:0x4ec28691 URL:[http://localhost:9203/](http://localhost:9203/)\>}

Any ideas of how to solve it? I used the port 9203 for ES because the 92000 was unavailable .  
Thank you

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 28, 2017, 8:15am UTC](https://discuss.elastic.co/t/please-help-importing-csv-with-logstash-and-create-an-index-in-elasticsearch/83689/3 "2017-04-28T08:15:01Z")

</div>

Please don't post pictures of text, they are difficult to read and some people may not be even able to see them 🙂

---

<div class="post-metadata">

**Author:** ![Alvaro\_Sanz\_Garrigue](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Alvaro\_Sanz\_Garrigue](https://discuss.elastic.co/u/Alvaro_Sanz_Garrigue)\
**Post date:** [April 28, 2017, 8:19am UTC](https://discuss.elastic.co/t/please-help-importing-csv-with-logstash-and-create-an-index-in-elasticsearch/83689/4 "2017-04-28T08:19:50Z")

</div>

OK I will not do it again.

I solve this problem you can close the topic.  
Thank you

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 28, 2017, 8:25am UTC](https://discuss.elastic.co/t/please-help-importing-csv-with-logstash-and-create-an-index-in-elasticsearch/83689/5 "2017-04-28T08:25:03Z")

</div>

> [@Alvaro\_Sanz\_Garrigue](#):
>
> I solve this problem you can close the topic.

How did you solve it? Sharing may help others in future.

---

<div class="post-metadata">

**Author:** ![Alvaro\_Sanz\_Garrigue](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Alvaro\_Sanz\_Garrigue](https://discuss.elastic.co/u/Alvaro_Sanz_Garrigue)\
**Post date:** [April 28, 2017, 8:49am UTC](https://discuss.elastic.co/t/please-help-importing-csv-with-logstash-and-create-an-index-in-elasticsearch/83689/6 "2017-04-28T08:49:33Z")

</div>

I finally make it works. I was doing it in the enterprise laptop which is restricted. I create a Ubuntu VM where I have the whole control, and there with the same configuration it finally works.  
So I guess that in my enterprise computer there were permissions issues or something like that which denies logstash to work as expected.

Thank you

---

<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:** [May 26, 2017, 8:57am UTC](https://discuss.elastic.co/t/please-help-importing-csv-with-logstash-and-create-an-index-in-elasticsearch/83689/7 "2017-05-26T08:57:16Z")

</div>

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