# Ingesting a csv file with logstash

**URL:** <https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076>\
**Category:** Logstash\
**Created:** [May 28, 2019, 11:18am UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076 "2019-05-28T11:18:51Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![decodeit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/decodeit/32/46023_2.png) [@decodeit](https://discuss.elastic.co/u/decodeit)\
**Post date:** [May 28, 2019, 11:18am UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/1 "2019-05-28T11:18:51Z")

</div>

Hello,  
I am trying to ingest a csv file with logstash.

Can someone check my logstash.conf file. I want the content to be stored in elasticsearch as well as to be printed on stdout.

input {  
file{  
path =\> ["/home/abhinavkumar.gurung/Applications/csv/devian/data/Admission\_Predict.csv"]  
start\_position =\> "beginning"  
#read from the beginning of the file  
sincedb\_path =\> "/dev/null"  
codec =\> plain {  
charset =\> "UTF-8"  
}  
}

}  
filter {  
csv{  
columns =\> ["Serial No","GRE Score","TOEFL Score","University Rating","SOP","LOR","CGPA","Research","Chance of Admit"]

separator =\> ","  
}

```
mutate {
	convert => {
			"Serial No" => "integer"
			"GRE Score" => "integer"
			"TOEFL Score" => "integer"
			"University Rating" => "integer"
			"SOP" => "float"
			"LOR" => "float"
			"CGPA" => "float"
			"Research" => "integer"
			"Chance of Admit" => "float"
		}
}

```

}  
output {  
elasticsearch {  
action =\> "index"  
hosts =\> ["elasticsearch:9200"]  
document\_type =\> "\_doc"  
user =\> elastic  
password =\> changeme  
index =\> "cars"  
}  
stdout {  
codec =\> rubydebug  
}  
}

---

<div class="post-metadata">

**Author:** ![Yoav\_Ben\_Moha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yoav_ben_moha/32/46202_2.png) [@Yoav\_Ben\_Moha](https://discuss.elastic.co/u/Yoav_Ben_Moha)\
**Post date:** [May 28, 2019, 12:55pm UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/2 "2019-05-28T12:55:42Z")

</div>

> [@decodeit](#):
>
> Can someone check my logstash.conf file. I want the content to be stored in elasticsearch as well as to be printed on stdout.

Did you try to it ? Did you get an error .... ?

---

<div class="post-metadata">

**Author:** ![decodeit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/decodeit/32/46023_2.png) [@decodeit](https://discuss.elastic.co/u/decodeit)\
**Post date:** [May 28, 2019, 1:02pm UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/3 "2019-05-28T13:02:29Z")

</div>

I did and i dont see any error but I don't see any out put on my std out or nothing stored in es.  
which log file should i post for more clarification.

---

<div class="post-metadata">

**Author:** ![Yoav\_Ben\_Moha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yoav_ben_moha/32/46202_2.png) [@Yoav\_Ben\_Moha](https://discuss.elastic.co/u/Yoav_Ben_Moha)\
**Post date:** [May 28, 2019, 1:03pm UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/4 "2019-05-28T13:03:46Z")

</div>

Did you try to run ?  
`bin/logstash -f /etc/logstash/<your_conf_file_name>.conf`

---

<div class="post-metadata">

**Author:** ![decodeit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/decodeit/32/46023_2.png) [@decodeit](https://discuss.elastic.co/u/decodeit)\
**Post date:** [May 28, 2019, 1:04pm UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/5 "2019-05-28T13:04:24Z")

</div>

I am running with docker-compose up.

version: '2'

services:

elasticsearch:  
build:  
context: elasticsearch/  
args:  
ELK\_VERSION: 7.0.1  
volumes:  
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro  
ports:  
- "9200:9200"  
- "9300:9300"  
environment:  
ES\_JAVA\_OPTS: "-Xmx256m -Xms256m"  
ELASTIC\_PASSWORD: changeme  
networks:  
- elk

logstash:  
build:  
context: logstash/  
args:  
ELK\_VERSION: 7.0.1  
volumes:  
- ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro  
- ./logstash/pipeline:/usr/share/logstash/pipeline:ro  
ports:  
- "5000:5000"  
- "9600:9600"  
environment:  
LS\_JAVA\_OPTS: "-Xmx256m -Xms256m"  
networks:  
- elk  
depends\_on:  
- elasticsearch

kibana:  
build:  
context: kibana/  
args:  
ELK\_VERSION: 7.0.1  
volumes:  
- ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml:ro  
ports:  
- "5601:5601"  
networks:  
- elk  
depends\_on:  
- elasticsearch

networks:

elk:  
driver: bridge

---

<div class="post-metadata">

**Author:** ![decodeit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/decodeit/32/46023_2.png) [@decodeit](https://discuss.elastic.co/u/decodeit)\
**Post date:** [May 29, 2019, 2:55pm UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/6 "2019-05-29T14:55:52Z")

</div>

any one with some knowledge on this, can share their thoughts. I have been stuck on this.  
thanks

---

<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:** [May 29, 2019, 4:02pm UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/7 "2019-05-29T16:02:13Z")

</div>

In the past, whenever a file input completely fails to read a file in a docker instance I have always found the answer is that the file is not mounted in the instance.

---

<div class="post-metadata">

**Author:** ![decodeit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/decodeit/32/46023_2.png) [@decodeit](https://discuss.elastic.co/u/decodeit)\
**Post date:** [May 30, 2019, 1:28am UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/8 "2019-05-30T01:28:08Z")

</div>

in my case, I can see that the file is being copied from my local folder to the logstash container. while the logstash was running, I checked the folder in the container and the data is there. Now I need to send that data to elastic search and on stdout as well. any suggestion on how can I do that?  
thanks

---

<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:** [May 30, 2019, 4:59am UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/9 "2019-05-30T04:59:58Z")

</div>

Hello,  
Hope this example helps you.  
[[Load csv file in logstash](https://discuss.elastic.co/t/load-csv-file-in-logstash/151319/3)]

---

<div class="post-metadata">

**Author:** ![decodeit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/decodeit/32/46023_2.png) [@decodeit](https://discuss.elastic.co/u/decodeit)\
**Post date:** [May 30, 2019, 10:25am UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/10 "2019-05-30T10:25:25Z")

</div>

I have same for the config file for logstash. Can i see the docker-compose file. My local csv file is being copied in logstash container but nothing shows in elasticsearch or stdout.  
What and where can I inspect. I will post my compose and config file in an hr

---

<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:** [May 30, 2019, 11:04am UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/11 "2019-05-30T11:04:47Z")

</div>

Hello,  
i think the problem is not with the input config file, but the way you are executing the logstash. Please check thoroughly.

---

<div class="post-metadata">

**Author:** ![decodeit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/decodeit/32/46023_2.png) [@decodeit](https://discuss.elastic.co/u/decodeit)\
**Post date:** [May 30, 2019, 11:16am UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/12 "2019-05-30T11:16:35Z")

</div>

I am executing logstash with docker-compose, could you check it if you see any thing . thanks

`version: '2'

services:

elasticsearch:  
build:  
context: elasticsearch/  
args:  
ELK\_VERSION: 7.0.1  
volumes:  
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro  
ports:  
- "9200:9200"  
- "9300:9300"  
environment:  
ES\_JAVA\_OPTS: "-Xmx256m -Xms256m"  
ELASTIC\_PASSWORD: changeme  
networks:  
- elk

logstash:  
build:  
context: logstash/  
args:  
ELK\_VERSION: 7.0.1  
volumes:  
- ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro  
- ./logstash/pipeline:/usr/share/logstash/pipeline:ro  
- ./path/to/storage:/usr/share/logstash/storage1:ro  
ports:  
- "5000:5000"  
- "9600:9600"  
environment:  
LS\_JAVA\_OPTS: "-Xmx256m -Xms256m"  
networks:  
- elk  
depends\_on:  
- elasticsearch

kibana:  
build:  
context: kibana/  
args:  
ELK\_VERSION: 7.0.1  
volumes:  
- ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml:ro  
ports:  
- "5601:5601"  
networks:  
- elk  
depends\_on:  
- elasticsearch

networks:

elk:  
driver: bridge`

---

<div class="post-metadata">

**Author:** ![decodeit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/decodeit/32/46023_2.png) [@decodeit](https://discuss.elastic.co/u/decodeit)\
**Post date:** [May 30, 2019, 11:58am UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/13 "2019-05-30T11:58:39Z")

</div>

Also, since logstash is not outputting anything even in the console, does that mean its not ingesting at all? logstash is able to copy the file from my local host to its container folder though.

---

<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:** [June 27, 2019, 11:58am UTC](https://discuss.elastic.co/t/ingesting-a-csv-file-with-logstash/183076/14 "2019-06-27T11:58:44Z")

</div>

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