# Regex for path command

**URL:** <https://discuss.elastic.co/t/regex-for-path-command/61952>\
**Category:** Logstash\
**Created:** [September 30, 2016, 7:29pm UTC](https://discuss.elastic.co/t/regex-for-path-command/61952 "2016-09-30T19:29:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_James](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tim_james/32/55697_2.png) [@Tim\_James](https://discuss.elastic.co/u/Tim_James)\
**Post date:** [September 30, 2016, 7:29pm UTC](https://discuss.elastic.co/t/regex-for-path-command/61952/1 "2016-09-30T19:29:27Z")

</div>

Hi,

Apologies for a newbie question.

I want to store data from a log file withe a name like ctc-2016-09-30.0.log but in the same directory there are many other log files I don't want, including one that is called ctc-metrics-2016-09-30.0.log.  
I can'f find a way of getting the one I want and not getting the one I don't.  
Are the patterns on the File - Path command a subset of regex as the ones I have tried seem not to work, and anything I try seems to include both logfiles?

Thanks for any assistance.

---

<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:** [October 3, 2016, 5:32am UTC](https://discuss.elastic.co/t/regex-for-path-command/61952/2 "2016-10-03T05:32:28Z")

</div>

The file input's `path` option lists filename patterns, not regular expressions. To select ctc-2016-09-30.0.log but not ctc-metrics-2016-09-30.0.log you could e.g. use ctc-????-??-??.\*.log in your pattern.

---

<div class="post-metadata">

**Author:** ![Tim\_James](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tim_james/32/55697_2.png) [@Tim\_James](https://discuss.elastic.co/u/Tim_James)\
**Post date:** [October 3, 2016, 9:25am UTC](https://discuss.elastic.co/t/regex-for-path-command/61952/3 "2016-10-03T09:25:17Z")

</div>

That's brilliant, thanks for your help.

---

<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:** [July 6, 2017, 4:36am UTC](https://discuss.elastic.co/t/regex-for-path-command/61952/4 "2017-07-06T04:36:10Z")

</div>


