<?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: How to add a column to a stats table using rex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-column-to-a-stats-table-using-rex/m-p/472856#M133098</link>
    <description>&lt;P&gt;Hi harshparikhxlrd&lt;BR /&gt;
if the field you want i ComputerName, probably you already have because Splunk recognize by itself the pair field=value.&lt;BR /&gt;
Anyway the regex to extract Computername is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "(?ms)ComputerName\=(?&amp;lt;Computername&amp;gt;[^ ]*)Task"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/0n0rks/1"&gt;https://regex101.com/r/0n0rks/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;So your search will be (sorry I cannot rewrite your regex because I cannot see it, use Code Sample button to share regexes):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=monitoring sourcetype=PEGA:WinEventLog:Application ( SourceName="RoboticLogging" OR SourceName="Application" ) ("Department=" "HRSS_STL") ("Type=" "Error") 
| rex "Message : (?.+.?)" 
| rex "(?ms)ComputerName\=(?&amp;lt;Computername&amp;gt;[^ ]*)Task"
| stats count by ex 
| rename ex as Exception 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2019 16:30:30 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2019-10-31T16:30:30Z</dc:date>
    <item>
      <title>How to add a column to a stats table using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-column-to-a-stats-table-using-rex/m-p/472854#M133096</link>
      <description>&lt;P&gt;I'm fairly new to splunk and have just learned how to use the rex/regex.  I am trying to add a column in my string search to a statistics table to display the name of the workstation.  This is my current string. &lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 16:03:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-column-to-a-stats-table-using-rex/m-p/472854#M133096</guid>
      <dc:creator>harshparikhxlrd</dc:creator>
      <dc:date>2019-10-31T16:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a column to a stats table using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-column-to-a-stats-table-using-rex/m-p/472855#M133097</link>
      <description>&lt;P&gt;Adding to previous post:&lt;/P&gt;

&lt;P&gt;Message=&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 16:06:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-column-to-a-stats-table-using-rex/m-p/472855#M133097</guid>
      <dc:creator>harshparikhxlrd</dc:creator>
      <dc:date>2019-10-31T16:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a column to a stats table using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-column-to-a-stats-table-using-rex/m-p/472856#M133098</link>
      <description>&lt;P&gt;Hi harshparikhxlrd&lt;BR /&gt;
if the field you want i ComputerName, probably you already have because Splunk recognize by itself the pair field=value.&lt;BR /&gt;
Anyway the regex to extract Computername is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "(?ms)ComputerName\=(?&amp;lt;Computername&amp;gt;[^ ]*)Task"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/0n0rks/1"&gt;https://regex101.com/r/0n0rks/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;So your search will be (sorry I cannot rewrite your regex because I cannot see it, use Code Sample button to share regexes):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=monitoring sourcetype=PEGA:WinEventLog:Application ( SourceName="RoboticLogging" OR SourceName="Application" ) ("Department=" "HRSS_STL") ("Type=" "Error") 
| rex "Message : (?.+.?)" 
| rex "(?ms)ComputerName\=(?&amp;lt;Computername&amp;gt;[^ ]*)Task"
| stats count by ex 
| rename ex as Exception 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 16:30:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-column-to-a-stats-table-using-rex/m-p/472856#M133098</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-31T16:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a column to a stats table using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-column-to-a-stats-table-using-rex/m-p/472857#M133099</link>
      <description>&lt;P&gt;Hi harshparikhxlrd,&lt;BR /&gt;
Try now:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=monitoring sourcetype=PEGA:WinEventLog:Application ( SourceName="RoboticLogging" OR SourceName="Application" ) ("Department=" "HRSS_STL") ("Type=" "Error") 
| rex "(?ms)ComputerName\=(?&amp;lt;Computername&amp;gt;[^ ]*)Task.*Message\=(?&amp;lt;Message&amp;gt;.*)"
| stats stats values(Message) As Message values(Computername) AS Computername count by ex 
| rename ex as Exception 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That you can test at &lt;A href="https://regex101.com/r/0n0rks/2"&gt;https://regex101.com/r/0n0rks/2&lt;/A&gt; .&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 08:07:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-column-to-a-stats-table-using-rex/m-p/472857#M133099</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-11-04T08:07:02Z</dc:date>
    </item>
  </channel>
</rss>

