# How to create filter match a string using regex?

**URL:** <https://discuss.elastic.co/t/how-to-create-filter-match-a-string-using-regex/148768>\
**Category:** Elasticsearch\
**Created:** [September 17, 2018, 7:08am UTC](https://discuss.elastic.co/t/how-to-create-filter-match-a-string-using-regex/148768 "2018-09-17T07:08:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bella](https://avatars.discourse-cdn.com/v4/letter/b/ce73a5/32.png) [@bella](https://discuss.elastic.co/u/bella)\
**Post date:** [September 17, 2018, 7:08am UTC](https://discuss.elastic.co/t/how-to-create-filter-match-a-string-using-regex/148768/1 "2018-09-17T07:08:22Z")

</div>

Hi there,

I was trying to create a filter to match field "source" and value "/var/log/nginx/\*-access.log", the log file name contains the domain name, e.g, /var/log/nginx/mydomain.com-access.log, couldn't get it work, help please.

{  
"query": {  
"match": {  
"source": {  
"query": "/var/log/nginx/\*-access.log",  
"type": "phrase"  
}  
}  
}  
}

---

<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:** [October 15, 2018, 7:17am UTC](https://discuss.elastic.co/t/how-to-create-filter-match-a-string-using-regex/148768/2 "2018-10-15T07:17:13Z")

</div>

Closed on October 15, 2018, 7:17am UTC

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