# What is the best way to represent a data using grok when an emailid is inside a quoted string?

**URL:** <https://discuss.elastic.co/t/what-is-the-best-way-to-represent-a-data-using-grok-when-an-emailid-is-inside-a-quoted-string/284673>\
**Category:** Elasticsearch\
**Tags:** ingest-pipeline\
**Created:** [September 21, 2021, 4:43am UTC](https://discuss.elastic.co/t/what-is-the-best-way-to-represent-a-data-using-grok-when-an-emailid-is-inside-a-quoted-string/284673 "2021-09-21T04:43:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shi](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@shi](https://discuss.elastic.co/u/shi)\
**Post date:** [September 21, 2021, 4:43am UTC](https://discuss.elastic.co/t/what-is-the-best-way-to-represent-a-data-using-grok-when-an-emailid-is-inside-a-quoted-string/284673/1 "2021-09-21T04:43:45Z")

</div>

We have got the predefined grok expressions EMAILADDRESS and QUOTEDSTRING available in elasticsearch/kibana

In my log I have the pattern  
[fromemailid="shi@gmail.com](mailto:fromemailid=%22shi@gmail.com)" [toemailid="ela@gmail.com](mailto:toemailid=%22ela@gmail.com)"

What is the best way to represent them so that elasitcsearch can give more meaningful information

fromemailid=%{QUOTEDSTRING,frommail} toemailid=%{QUOTEDSTRING,tomail}

or

fromemailid="%{EMAILADDRESS,frommail}" toemailid="%{EMAILADDRESS,tomail}"

or

fromemailid="(?{EMAILADDRESS})" tomailid="(?{EMAILADDRESS})"

.....

or  
Are all the above patterns equivalent?  
regards  
shini

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 21, 2021, 6:19am UTC](https://discuss.elastic.co/t/what-is-the-best-way-to-represent-a-data-using-grok-when-an-emailid-is-inside-a-quoted-string/284673/2 "2021-09-21T06:19:07Z")

</div>

They are definitely not the same, see [https://github.com/elastic/elasticsearch/blob/7.14/libs/grok/src/main/resources/patterns/grok-patterns#L19](https://github.com/elastic/elasticsearch/blob/7.14/libs/grok/src/main/resources/patterns/grok-patterns#L19) and [https://github.com/elastic/elasticsearch/blob/7.14/libs/grok/src/main/resources/patterns/grok-patterns#L4](https://github.com/elastic/elasticsearch/blob/7.14/libs/grok/src/main/resources/patterns/grok-patterns#L4) respectively.

---

<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 19, 2021, 6:19am UTC](https://discuss.elastic.co/t/what-is-the-best-way-to-represent-a-data-using-grok-when-an-emailid-is-inside-a-quoted-string/284673/3 "2021-10-19T06:19:12Z")

</div>

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