<?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: Help with regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/512720#M143816</link>
    <description>&lt;P&gt;1st regex&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|makeresults 
| eval _raw="default_message= &amp;lt;14&amp;gt;shell: cmd by abcd: mkdir test"
| rex "cmd by (?&amp;lt;user&amp;gt;[^\:]+): (?&amp;lt;command&amp;gt;[^\s]+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2nd regex will combine both and work for 1st and second:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|makeresults 
| eval test="default_message= &amp;lt;14&amp;gt;shell: cmd by abcd: mkdir test|default_message= &amp;lt;133&amp;gt;clish[1234]: User abcd finished running clish -c from CLI shell"
| makemv test delim="|"
| mvexpand test
| rex field=test "cmd by (?&amp;lt;user1&amp;gt;[^\:]+): (?&amp;lt;command1&amp;gt;[^\s]+)"
| rex field=test  "User (?&amp;lt;user2&amp;gt;[^\s]+) (?&amp;lt;command2&amp;gt;.*)"
| eval user=coalesce(user1,user2),command=coalesce(command1,command2)
| table test user command&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Aug 2020 12:07:56 GMT</pubDate>
    <dc:creator>thambisetty</dc:creator>
    <dc:date>2020-08-06T12:07:56Z</dc:date>
    <item>
      <title>Help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/512716#M143815</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have below in column default_message&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1st regex :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;default_message= &amp;lt;14&amp;gt;shell: cmd by &lt;STRONG&gt;abcd&lt;/STRONG&gt;: mkdir test&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;can you please help me with the regex to extract user here and the command run by the user in another column command. We can consider the : as the delimiter&amp;nbsp;after user&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;here i should be able to extract &lt;STRONG&gt;user&lt;/STRONG&gt;=abcd and &lt;STRONG&gt;command&lt;/STRONG&gt;=mkdir test&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2nd regex :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="t a"&gt;default_message= &amp;lt;&lt;SPAN class="t"&gt;133&lt;/SPAN&gt;&amp;gt;&lt;SPAN class="t"&gt;clish&lt;/SPAN&gt;[&lt;SPAN class="t"&gt;1234&lt;/SPAN&gt;]&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="t"&gt;User&lt;/SPAN&gt;&amp;nbsp;&lt;STRONG&gt;abcd&lt;/STRONG&gt;&amp;nbsp;&lt;SPAN class="t"&gt;finished&lt;/SPAN&gt; &lt;SPAN class="t"&gt;running&lt;/SPAN&gt; &lt;SPAN class="t"&gt;clish&lt;/SPAN&gt; &lt;SPAN class="t"&gt;-c&lt;/SPAN&gt; &lt;SPAN class="t"&gt;from&lt;/SPAN&gt; &lt;SPAN class="t"&gt;CLI&lt;/SPAN&gt; &lt;SPAN class="t"&gt;shell&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="t"&gt;same column we need to extract &lt;STRONG&gt;user&lt;/STRONG&gt;=abcd and &lt;STRONG&gt;command&lt;/STRONG&gt;=finished running clish -c from CLI shell&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please help me with the regex.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If we can combine above two it would be great. else i will have to use some case and then do the regex. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 11:41:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/512716#M143815</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2020-08-06T11:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/512720#M143816</link>
      <description>&lt;P&gt;1st regex&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|makeresults 
| eval _raw="default_message= &amp;lt;14&amp;gt;shell: cmd by abcd: mkdir test"
| rex "cmd by (?&amp;lt;user&amp;gt;[^\:]+): (?&amp;lt;command&amp;gt;[^\s]+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2nd regex will combine both and work for 1st and second:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|makeresults 
| eval test="default_message= &amp;lt;14&amp;gt;shell: cmd by abcd: mkdir test|default_message= &amp;lt;133&amp;gt;clish[1234]: User abcd finished running clish -c from CLI shell"
| makemv test delim="|"
| mvexpand test
| rex field=test "cmd by (?&amp;lt;user1&amp;gt;[^\:]+): (?&amp;lt;command1&amp;gt;[^\s]+)"
| rex field=test  "User (?&amp;lt;user2&amp;gt;[^\s]+) (?&amp;lt;command2&amp;gt;.*)"
| eval user=coalesce(user1,user2),command=coalesce(command1,command2)
| table test user command&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 12:07:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/512720#M143816</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-08-06T12:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/512724#M143817</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129407"&gt;@thambisetty&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your quick reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It working well to extract user but command2 its showing only finished/running/logged.&amp;nbsp;&lt;/P&gt;&lt;P&gt;whereas i want the full text after the user2 field form the column.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 12:04:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/512724#M143817</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2020-08-06T12:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/512726#M143818</link>
      <description>&lt;P&gt;check updated answer. I misunderstood.&lt;/P&gt;&lt;P&gt;------------------------------&lt;/P&gt;&lt;P&gt;up vote if it works.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 12:06:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/512726#M143818</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-08-06T12:06:52Z</dc:date>
    </item>
  </channel>
</rss>

