# Import CSV File as input in logstash and the output data to elasticsearch

**URL:** <https://discuss.elastic.co/t/import-csv-file-as-input-in-logstash-and-the-output-data-to-elasticsearch/82873>\
**Category:** Logstash\
**Created:** [April 19, 2017, 11:22am UTC](https://discuss.elastic.co/t/import-csv-file-as-input-in-logstash-and-the-output-data-to-elasticsearch/82873 "2017-04-19T11:22:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![zegdene](https://avatars.discourse-cdn.com/v4/letter/z/76d3ee/32.png) [@zegdene](https://discuss.elastic.co/u/zegdene)\
**Post date:** [April 19, 2017, 11:22am UTC](https://discuss.elastic.co/t/import-csv-file-as-input-in-logstash-and-the-output-data-to-elasticsearch/82873/1 "2017-04-19T11:22:02Z")

</div>

Hi,  
I'm new in elasticsearch, i install elasticsearch, logstash and kibana, i need to import a CSV file as input in logstash and pass the outuput data to elasticsearch, I create the index in elasticsearch , in kibana i apprciate th index but any thing from the data i can't visualize the data .  
please can help me .  
my code is:

```
input {
  file {
    path => "/Users/salma/Desktop/friends.csv"
    start_position => "beginning"
    sincedb_path => "/dev/null"
  }
}
filter {
  csv {
     separator => ","
    columns => ["id","name","age","money"]
  }
}
output {
   elasticsearch {
     hosts => "http://localhost:9200"
     index => "data-index"
  }
stdout {}
}

```

I run logstash and he reurn this message :  
Could not find log4j2 configuration at path /Project/elk/logstash/config/log4j2.  
properties. Using default config which logs to console  
12:05:30.200 [[main]-pipeline-manager] INFO logstash.pipeline - Starting pipeli  
ne {"id"=\>"main", "pipeline.workers"=\>4, "pipeline.batch.size"=\>125, "pipeline.b  
atch.delay"=\>5, "pipeline.max\_inflight"=\>500}  
12:05:30.562 [[main]-pipeline-manager] INFO logstash.pipeline - Pipeline main s  
tarted  
12:05:30.662 [Api Webserver] INFO logstash.agent - Successfully started Logstas  
h API endpoint {:port=\>9600}

---

<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:** [April 20, 2017, 7:48am UTC](https://discuss.elastic.co/t/import-csv-file-as-input-in-logstash-and-the-output-data-to-elasticsearch/82873/2 "2017-04-20T07:48:05Z")

</div>

Are you seeing anything in Kibana? If yes, what?

---

<div class="post-metadata">

**Author:** ![zegdene](https://avatars.discourse-cdn.com/v4/letter/z/76d3ee/32.png) [@zegdene](https://discuss.elastic.co/u/zegdene)\
**Post date:** [April 20, 2017, 8:03am UTC](https://discuss.elastic.co/t/import-csv-file-as-input-in-logstash-and-the-output-data-to-elasticsearch/82873/3 "2017-04-20T08:03:40Z")

</div>

Hi Magnus,  
I see just the index create in elasticsearch and i can't start the logstash and elasticsearch services

---

<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:** [April 20, 2017, 10:05am UTC](https://discuss.elastic.co/t/import-csv-file-as-input-in-logstash-and-the-output-data-to-elasticsearch/82873/4 "2017-04-20T10:05:12Z")

</div>

> I see just the index create in elasticsearch

What do you mean?

> and i can't start the logstash and elasticsearch services

Tell us more about this.

---

<div class="post-metadata">

**Author:** ![zegdene](https://avatars.discourse-cdn.com/v4/letter/z/76d3ee/32.png) [@zegdene](https://discuss.elastic.co/u/zegdene)\
**Post date:** [April 20, 2017, 10:19am UTC](https://discuss.elastic.co/t/import-csv-file-as-input-in-logstash-and-the-output-data-to-elasticsearch/82873/5 "2017-04-20T10:19:06Z")

</div>

Hi,  
I don't see any data in kibana . when i start the logstach service windows me return an error .

---

<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:** [April 20, 2017, 11:02am UTC](https://discuss.elastic.co/t/import-csv-file-as-input-in-logstash-and-the-output-data-to-elasticsearch/82873/6 "2017-04-20T11:02:12Z")

</div>

> when i start the logstach service windows me return an error

Without more details about the error you're getting it's impossible to help.

---

<div class="post-metadata">

**Author:** ![zegdene](https://avatars.discourse-cdn.com/v4/letter/z/76d3ee/32.png) [@zegdene](https://discuss.elastic.co/u/zegdene)\
**Post date:** [April 20, 2017, 1:31pm UTC](https://discuss.elastic.co/t/import-csv-file-as-input-in-logstash-and-the-output-data-to-elasticsearch/82873/7 "2017-04-20T13:31:35Z")

</div>

when i run the logstash service window return this error:  
 ![](https://us1.discourse-cdn.com/elastic/original/3X/7/8/7899c5500110887315052004cfec0f00105d9e68.PNG)

---

<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:** [April 20, 2017, 1:43pm UTC](https://discuss.elastic.co/t/import-csv-file-as-input-in-logstash-and-the-output-data-to-elasticsearch/82873/8 "2017-04-20T13:43:58Z")

</div>

Does the service configuration point to a file that doesn't exist?

[discuss.elastic.co](http://discuss.elastic.co) has a French-speaking group that might be a better fit for you.

---

<div class="post-metadata">

**Author:** ![zegdene](https://avatars.discourse-cdn.com/v4/letter/z/76d3ee/32.png) [@zegdene](https://discuss.elastic.co/u/zegdene)\
**Post date:** [April 20, 2017, 4:01pm UTC](https://discuss.elastic.co/t/import-csv-file-as-input-in-logstash-and-the-output-data-to-elasticsearch/82873/9 "2017-04-20T16:01:20Z")

</div>

yes the service configuration point to a file doesn't exist

I create test.conf  
input {  
file {  
path =\> "/Users/salma/Desktop/creditcard.csv"  
start\_position =\> "beginning"  
sincedb\_path =\> "/dev/null"  
}  
}  
filter {  
csv {  
separator =\> ","  
columns =\> ["Time","V1","V2","V3","V4","V5","V6","V7","V8","V9","V10","V11","V12","V13","V14","V15","V16","V17","V18","V19","V20","V21","V22","V23","V24","V25","V26","V27","V28","Amount"]  
remove\_field =\> ["class"]  
}  
}  
output {  
elasticsearch {  
hosts =\> "[http://localhost:9200](http://localhost:9200)"  
index =\> "dataset"  
}  
}  
this error appreas:

```
C:\Project\elk\logstash\bin>logstash -f test.conf
Picked up _JAVA_OPTIONS: -Xmx512M -Xms256M
Could not find log4j2 configuration at path /Project/elk/logstash/config/log4j2.
properties. Using default config which logs to console
16:17:36.800 [[main]-pipeline-manager] INFO logstash.outputs.elasticsearch - El
asticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://localhos
t:9200/]}}
16:17:36.810 [[main]-pipeline-manager] INFO logstash.outputs.elasticsearch - Ru
nning health check to see if an Elasticsearch connection is working {:healthchec
k_url=>http://localhost:9200/, :path=>"/"}
16:17:36.950 [[main]-pipeline-manager] WARN logstash.outputs.elasticsearch - Re
stored connection to ES instance {:url=>#<URI::HTTP:0x478f1ddb URL:http://localh
ost:9200/>}
16:17:36.960 [[main]-pipeline-manager] INFO logstash.outputs.elasticsearch - Us
ing mapping template from {:path=>nil}
16:17:37.240 [[main]-pipeline-manager] INFO logstash.outputs.elasticsearch - At
tempting to install template {:manage_template=>{"template"=>"logstash-*", "vers
ion"=>50001, "settings"=>{"index.refresh_interval"=>"5s"}, "mappings"=>{"_defaul
t_"=>{"_all"=>{"enabled"=>true, "norms"=>false}, "dynamic_templates"=>[{"message
_field"=>{"path_match"=>"message", "match_mapping_type"=>"string", "mapping"=>{"
type"=>"text", "norms"=>false}}}, {"string_fields"=>{"match"=>"*", "match_mappin
g_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false, "fields"=>{"keywo
rd"=>{"type"=>"keyword"}}}}}], "properties"=>{"@timestamp"=>{"type"=>"date", "in
clude_in_all"=>false}, "@version"=>{"type"=>"keyword", "include_in_all"=>false},
 "geoip"=>{"dynamic"=>true, "properties"=>{"ip"=>{"type"=>"ip"}, "location"=>{"t
ype"=>"geo_point"}, "latitude"=>{"type"=>"half_float"}, "longitude"=>{"type"=>"h
alf_float"}}}}}}}}
16:17:37.250 [[main]-pipeline-manager] INFO logstash.outputs.elasticsearch - Ne
w Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>[#<U
RI::HTTP:0x7bf2ccce URL:http://localhost:9200>]}
16:17:37.260 [[main]-pipeline-manager] INFO logstash.pipeline - Starting pipeli
ne {"id"=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.b
atch.delay"=>5, "pipeline.max_inflight"=>500}
16:17:37.735 [[main]-pipeline-manager] INFO logstash.pipeline - Pipeline main s
tarted
16:17:37.863 [Api Webserver] INFO logstash.agent - Successfully started Logstas
h API endpoint {:port=>9600}
```

---

<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:** [April 21, 2017, 5:21am UTC](https://discuss.elastic.co/t/import-csv-file-as-input-in-logstash-and-the-output-data-to-elasticsearch/82873/10 "2017-04-21T05:21:45Z")

</div>

Logstash is starting up just fine. Read the whole log.

---

<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 19, 2017, 5:22am UTC](https://discuss.elastic.co/t/import-csv-file-as-input-in-logstash-and-the-output-data-to-elasticsearch/82873/11 "2017-05-19T05:22:08Z")

</div>

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