<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reg - username extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600432#M209018</link>
    <description>&lt;P&gt;Yeah, the log is JSON type, Thanks for your support I'll try this out with your examples and let you know if those work, or else I'll try to send the full logs.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jun 2022 09:48:47 GMT</pubDate>
    <dc:creator>Sasti</dc:creator>
    <dc:date>2022-06-03T09:48:47Z</dc:date>
    <item>
      <title>Reg - How do I extract username?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600385#M208998</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I'm trying to extract the username from the _raw field using regex, how do I extract the username. The username comes after some parameters, the parameters look like (\"requestParameters\": {\"userName\": &amp;lt;username&amp;gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 22:01:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600385#M208998</guid>
      <dc:creator>Sasti</dc:creator>
      <dc:date>2022-06-03T22:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: Reg - username extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600387#M208999</link>
      <description>&lt;P&gt;What have you tried so far and what's the result?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 06:22:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600387#M208999</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-06-03T06:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Reg - username extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600391#M209002</link>
      <description>&lt;P&gt;So I tried some regex likes(rex field=_raw "requestParameters\:(?P&amp;lt;userName&amp;gt;(.*))\=", rex field=_raw "requestParameters\: userName:\s(?&amp;lt;user&amp;gt;[^\/]+)", rex field=_raw "requestParameters":\s{\"userName"\:[a-zA-Z]+(?=+(?:"}" ) and the result is nothing it's not fetching the username.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 06:40:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600391#M209002</guid>
      <dc:creator>Sasti</dc:creator>
      <dc:date>2022-06-03T06:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Reg - username extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600394#M209004</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/246448"&gt;@Sasti&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;this log seems to be a json, did you tried to use the "INDEXED_EXTRACTIONS = JSON" option in props.conf?&lt;/P&gt;&lt;P&gt;or did you tried to use the "spath" command in search?&lt;/P&gt;&lt;P&gt;Anyway, if you want to use a regex, lete me understand, does you log contain?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\"requestParameters\": {\"userName\": &amp;lt;username&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;or&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"requestParameters": {"userName": &amp;lt;username&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;in other words: in your logs are there slashes before quotes or not?&lt;/P&gt;&lt;P&gt;if yes, you could use a regex like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\\\"requestParameters\\\": \{\\\"userName\\\": \&amp;lt;(?&amp;lt;username&amp;gt;[^\&amp;gt;]*)"&lt;/LI-CODE&gt;&lt;P&gt;if it doesn't run, please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\\\\"requestParameters\\\\": \{\\\\"userName\\\\": \&amp;lt;(?&amp;lt;username&amp;gt;[^\&amp;gt;]*)"&lt;/LI-CODE&gt;&lt;P&gt;If instead you don't have backslashes before quotes (as I suppose), please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\"requestParameters\": \{\"userName\": \&amp;lt;(?&amp;lt;username&amp;gt;[^\&amp;gt;]*)"&lt;/LI-CODE&gt;&lt;P&gt;If you could share a full logs I could be more sure&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 07:02:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600394#M209004</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-06-03T07:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Reg - username extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600432#M209018</link>
      <description>&lt;P&gt;Yeah, the log is JSON type, Thanks for your support I'll try this out with your examples and let you know if those work, or else I'll try to send the full logs.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 09:48:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600432#M209018</guid>
      <dc:creator>Sasti</dc:creator>
      <dc:date>2022-06-03T09:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Reg - username extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600434#M209020</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thanks dude,&amp;nbsp; now I can able to extract the username. let's have fun and enjoy.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 10:00:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600434#M209020</guid>
      <dc:creator>Sasti</dc:creator>
      <dc:date>2022-06-03T10:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Reg - username extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600438#M209022</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/246448"&gt;@Sasti&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the Contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 10:09:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reg-How-do-I-extract-username/m-p/600438#M209022</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-06-03T10:09:17Z</dc:date>
    </item>
  </channel>
</rss>

