# Use regex in path definition

**URL:** <https://discuss.elastic.co/t/use-regex-in-path-definition/71201>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [January 11, 2017, 10:08am UTC](https://discuss.elastic.co/t/use-regex-in-path-definition/71201 "2017-01-11T10:08:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dwjvaughan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dwjvaughan/32/10648_2.png) [@dwjvaughan](https://discuss.elastic.co/u/dwjvaughan)\
**Post date:** [January 11, 2017, 10:08am UTC](https://discuss.elastic.co/t/use-regex-in-path-definition/71201/1 "2017-01-11T10:08:31Z")

</div>

Is it possible to use regex when defining the path? I see the [documentation](https://www.elastic.co/guide/en/beats/filebeat/current/configuration-filebeat-options.html#_paths) states it uses Golang Glob which seems to indicate that it's possible, but I can't seem to get it to work.

I have the following:

```
filebeat.prospectors:

- input_type: log

  paths:

    - E:\server\logs\[0-9]{8}.log

```

I've tried a few variations of this too. I'm essentially after the following type of files:

E:\server\logs\20170111.log

The folder contains other .log files that I want to ignore though. Any help much appreciated.

Thanks,  
Dave

---

<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:** [January 11, 2017, 10:38am UTC](https://discuss.elastic.co/t/use-regex-in-path-definition/71201/2 "2017-01-11T10:38:21Z")

</div>

> I see the documentation states it uses Golang Glob which seems to indicate that it's possible

But glob expressions and regexps are not the same thing.

How about looking for `20??????.log`?

---

<div class="post-metadata">

**Author:** ![dwjvaughan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dwjvaughan/32/10648_2.png) [@dwjvaughan](https://discuss.elastic.co/u/dwjvaughan)\
**Post date:** [January 11, 2017, 10:46am UTC](https://discuss.elastic.co/t/use-regex-in-path-definition/71201/3 "2017-01-11T10:46:16Z")

</div>

Hi Magnus,

Yes, you're right - it seems I was looking at the wrong bit of the Golang docs.

I actually got it working with something very similar:

```
20*.log

```

I think I prefer your method though, it's slightly more precise.

By the time 2100 comes around, I'll (hopefully) be retired 🙂

---

<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:** [February 8, 2017, 10:47am UTC](https://discuss.elastic.co/t/use-regex-in-path-definition/71201/4 "2017-02-08T10:47:17Z")

</div>

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