# Using 2 .csv inputs

**URL:** <https://discuss.elastic.co/t/using-2-csv-inputs/190044>\
**Category:** Logstash\
**Created:** [July 11, 2019, 2:42pm UTC](https://discuss.elastic.co/t/using-2-csv-inputs/190044 "2019-07-11T14:42:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yess](https://avatars.discourse-cdn.com/v4/letter/y/d2c977/32.png) [@yess](https://discuss.elastic.co/u/yess)\
**Post date:** [July 11, 2019, 2:42pm UTC](https://discuss.elastic.co/t/using-2-csv-inputs/190044/1 "2019-07-11T14:42:06Z")

</div>

I am trying to use 2 folders with .csv logs in as the input to my .conf file, yet it doesn't seem to work:  
here is my code

```
    input{
	file {
		type => "file1"
		path => "/place/holder/place/holder/*.csv"
		start_position => "beginning"
		sincedb_path => "/dev/null"
	}
	file{
		type => "file2"
		path => "/place/holder/place/holder/*.csv"
		start_position => "beginning"
		sincedb_path => "/dev/null"
	}
}

filter {
	if [type] == "file1"{
		csv {
			separator => ","
			columns => ["column1","column1","column3"]
			}
		
			
		}
		
	if [type] == "file2"{
		csv {
			separator => ","
			columns => ["column4","column5","column6"]
		}
	}	
		
	
}
output{
	if [type] == "file1"{
	elasticsearch{
		hosts => "http://localhost:9200"
		index => "data-index"
		}
	}
		
		if [type] == "file2"{
		elasticsearch{
		hosts => "http://localhost:9200"
		index => "data-index"
		}
	}

stdout {}
}
```

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [July 11, 2019, 2:45pm UTC](https://discuss.elastic.co/t/using-2-csv-inputs/190044/2 "2019-07-11T14:45:43Z")

</div>

Try this

```
	file {
	path => ["/place/holder/place/holder/*.csv", "/place/holder/place/holder/*.csv"]
	start_position => "beginning"
	sincedb_path => "/dev/null"
}

```

Use a grok in filter to extract type from path field ...

```
## Extract file name from path
grok { match => ["path","%{GREEDYDATA}/%{GREEDYDATA:FileName}\.csv"]}
```

---

<div class="post-metadata">

**Author:** ![yess](https://avatars.discourse-cdn.com/v4/letter/y/d2c977/32.png) [@yess](https://discuss.elastic.co/u/yess)\
**Post date:** [July 11, 2019, 2:59pm UTC](https://discuss.elastic.co/t/using-2-csv-inputs/190044/3 "2019-07-11T14:59:19Z")

</div>

> [@ylasri](#):
>
> GREEDYDATA:FileName

what would this be?

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [July 11, 2019, 3:34pm UTC](https://discuss.elastic.co/t/using-2-csv-inputs/190044/4 "2019-07-11T15:34:33Z")

</div>

Just giving you an example on what you can extract from the path attribute  
I am not sure on what are you trying to achieve, but you can extract the folder name or the prefix of the files in a folder that can help to populate type field .....

---

<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:** [August 8, 2019, 3:34pm UTC](https://discuss.elastic.co/t/using-2-csv-inputs/190044/5 "2019-08-08T15:34:36Z")

</div>

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