# Logstash: File Input does not work

**URL:** https://discuss.elastic.co/t/logstash-file-input-does-not-work/206476
**Category:** Logstash
**Created:** [November 4, 2019, 8:24pm UTC](https://discuss.elastic.co/t/logstash-file-input-does-not-work/206476 "2019-11-04T20:24:28Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![kcb](https://avatars.discourse-cdn.com/v4/letter/k/da6949/32.png) [@kcb](https://discuss.elastic.co/u/kcb)
#### Post date: [November 4, 2019, 8:24pm UTC](https://discuss.elastic.co/t/logstash-file-input-does-not-work/206476/1 "2019-11-04T20:24:29Z")

</div>

We have written a logstash script to process a simple ASCII file and export contents to stdout{}. We have verified the script works when the input is specified as stdin{}

However, we cannot get the script to work when we specify a file as the input.

Config file contents are:  
input {  
file {  
path =\> "C:\logstash-7.4.1\conf\sample.log"  
start\_position =\> "beginning"  
sincedb\_path =\> "nul"  
ignore\_older =\> 0  
}  
}

filter {  
# Add filter here. This sample has a blank filter.  
grok {  
match =\> [  
"message", "%{TIMESTAMP\_ISO8601:timestamp\_string}%{SPACE}%{GREEDYDATA:line}"  
]  
}

date {  
match =\> ["timestamp\_string", "ISO8601"]  
}

mutate {  
remove\_field =\> [message, timestamp\_string]  
}  
}

output {  
stdout {}  
}

sample.log contents are:  
2007-03-01T13:00:00Z I met a traveller from an antique land  
2007-03-01T13:00:01Z Who said-"Two vast and trunkless legs of stone

---

<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: [November 4, 2019, 8:30pm UTC](https://discuss.elastic.co/t/logstash-file-input-does-not-work/206476/2 "2019-11-04T20:30:54Z")

</div>

Do not use backslash in the path option of a file input, use forward slash. Also, remove

```
ignore_older => 0

```

That will cause the file input to ignore all files.

---

<div class="post-metadata">

### Author: ![kcb](https://avatars.discourse-cdn.com/v4/letter/k/da6949/32.png) [@kcb](https://discuss.elastic.co/u/kcb)
#### Post date: [November 4, 2019, 9:20pm UTC](https://discuss.elastic.co/t/logstash-file-input-does-not-work/206476/3 "2019-11-04T21:20:37Z")

</div>

Thanks. This now works.

---

<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 2, 2019, 9:20pm UTC](https://discuss.elastic.co/t/logstash-file-input-does-not-work/206476/4 "2019-12-02T21:20:42Z")

</div>

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