# Logstash CSV plugin behaviour for realtime CSV files

**URL:** <https://discuss.elastic.co/t/logstash-csv-plugin-behaviour-for-realtime-csv-files/106396>\
**Category:** Logstash\
**Created:** [November 5, 2017, 1:58am UTC](https://discuss.elastic.co/t/logstash-csv-plugin-behaviour-for-realtime-csv-files/106396 "2017-11-05T01:58:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shashwat](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@shashwat](https://discuss.elastic.co/u/shashwat)\
**Post date:** [November 5, 2017, 1:58am UTC](https://discuss.elastic.co/t/logstash-csv-plugin-behaviour-for-realtime-csv-files/106396/1 "2017-11-05T01:58:14Z")

</div>

Hi ,

I am facing some issue with logstash (5.6.2) CSV plugin's behaviour. Following is my scenarion :

I am receving .csv file every minute. I send this file to logstash. Intially around 10 mins everyhing works fine but after that logstash starts mixing the columns. For example: I start getting the values of column 3 in column 1 and it is random between the columns. Why is it happening?  
Following is my conf for logstash.  
input {

```
file {   
	type => "report"
	path => ["/data/logs/feeder.csv"]
	sincedb_path=> "dev/null"
}	

```

}

filter {   
csv {  
separator =\> ","  
columns =\> ["Name","Age","Salary","Address","Phone","ZipCode","City","Country","CarNumber"]  
}

```
    mutate {convert => ["Salary", "float"]}       

```

}

output {

```
if [type] == "report" {
        elasticsearch {
		hosts => "localhost:9200"
		index => "logstash-report"
		document_type => "elkdoc"
}
stdout {codec => rubydebug}
}

```

}

---

<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:** [November 6, 2017, 6:11am UTC](https://discuss.elastic.co/t/logstash-csv-plugin-behaviour-for-realtime-csv-files/106396/2 "2017-11-06T06:11:44Z")

</div>

Show an example of an incorrect document.

---

<div class="post-metadata">

**Author:** ![shashwat](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@shashwat](https://discuss.elastic.co/u/shashwat)\
**Post date:** [November 6, 2017, 9:59pm UTC](https://discuss.elastic.co/t/logstash-csv-plugin-behaviour-for-realtime-csv-files/106396/3 "2017-11-06T21:59:55Z")

</div>

Hi Magnus,

I am able to resolve this problem. I was deleting the previous files just before feeding the new one to logstash. Due to this it was somehow misbehaving. May be, logstash still reading the previous files and I was trying to delete them at the same time.  
When I removed the statement for deleting the previous file , it work fine. I will have to schedule the deletion in some other way.

Thanks,

---

<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:** [December 4, 2017, 10:00pm UTC](https://discuss.elastic.co/t/logstash-csv-plugin-behaviour-for-realtime-csv-files/106396/4 "2017-12-04T22:00:02Z")

</div>

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