# Grok pattern to extract username on %{GREEDYDATA:log}

**URL:** <https://discuss.elastic.co/t/grok-pattern-to-extract-username-on-greedydata-log/123076>\
**Category:** Logstash\
**Created:** [March 8, 2018, 1:19pm UTC](https://discuss.elastic.co/t/grok-pattern-to-extract-username-on-greedydata-log/123076 "2018-03-08T13:19:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tshepo\_Moganedi](https://avatars.discourse-cdn.com/v4/letter/t/d9b06d/32.png) [@Tshepo\_Moganedi](https://discuss.elastic.co/u/Tshepo_Moganedi)\
**Post date:** [March 8, 2018, 1:19pm UTC](https://discuss.elastic.co/t/grok-pattern-to-extract-username-on-greedydata-log/123076/1 "2018-03-08T13:19:52Z")

</div>

Hi,

I am trying to strip out Username from the following line and put it in the variable:

2017-06-01 17:05:59,429 INFO - Obtaining UserName: [admin] roles and privileges from DataBase.

What will be grok pattern for this line, Please help

---

<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:** [March 8, 2018, 1:51pm UTC](https://discuss.elastic.co/t/grok-pattern-to-extract-username-on-greedydata-log/123076/2 "2018-03-08T13:51:19Z")

</div>

Have you tried using the grok constructor web site?

---

<div class="post-metadata">

**Author:** ![Tshepo\_Moganedi](https://avatars.discourse-cdn.com/v4/letter/t/d9b06d/32.png) [@Tshepo\_Moganedi](https://discuss.elastic.co/u/Tshepo_Moganedi)\
**Post date:** [March 8, 2018, 2:06pm UTC](https://discuss.elastic.co/t/grok-pattern-to-extract-username-on-greedydata-log/123076/3 "2018-03-08T14:06:51Z")

</div>

yes, I have tried grok constructor, It does not give me right pattern.

---

<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:** [April 5, 2018, 2:07pm UTC](https://discuss.elastic.co/t/grok-pattern-to-extract-username-on-greedydata-log/123076/4 "2018-04-05T14:07:29Z")

</div>

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