<?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 Extract two field into two variable from a single line of log in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-two-field-into-two-variable-from-a-single-line-of-log/m-p/411439#M118690</link>
    <description>&lt;P&gt;I want to extract the  PID number from the log and store in variable failedPID. i have many of this kind of message with different Application Names.&lt;/P&gt;

&lt;P&gt;Application: &lt;STRONG&gt;MM Viewer&lt;/STRONG&gt;, PID: &lt;STRONG&gt;7988&lt;/STRONG&gt; failed&lt;BR /&gt;
Application: &lt;STRONG&gt;Database Browser App&lt;/STRONG&gt;, PID: &lt;STRONG&gt;6788&lt;/STRONG&gt; failed&lt;BR /&gt;
Application: &lt;STRONG&gt;CentralViewer&lt;/STRONG&gt;, PID: &lt;STRONG&gt;7978&lt;/STRONG&gt; failed&lt;/P&gt;

&lt;P&gt;i am using &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex  "Application:  (?&amp;lt;failedPID&amp;gt;.*) failed" | dedup 1 _time | chart count by failedPID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which is giving me output as&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;MM Viewer, PID: 7988
Database Browser App, PID: 6788
CentralViewer, PID: 7978
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;my ultimate goal is to store Application name in failedApp variable and PID in failedPID avriable.&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jul 2019 10:39:13 GMT</pubDate>
    <dc:creator>anilkashyap</dc:creator>
    <dc:date>2019-07-31T10:39:13Z</dc:date>
    <item>
      <title>Extract two field into two variable from a single line of log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-two-field-into-two-variable-from-a-single-line-of-log/m-p/411439#M118690</link>
      <description>&lt;P&gt;I want to extract the  PID number from the log and store in variable failedPID. i have many of this kind of message with different Application Names.&lt;/P&gt;

&lt;P&gt;Application: &lt;STRONG&gt;MM Viewer&lt;/STRONG&gt;, PID: &lt;STRONG&gt;7988&lt;/STRONG&gt; failed&lt;BR /&gt;
Application: &lt;STRONG&gt;Database Browser App&lt;/STRONG&gt;, PID: &lt;STRONG&gt;6788&lt;/STRONG&gt; failed&lt;BR /&gt;
Application: &lt;STRONG&gt;CentralViewer&lt;/STRONG&gt;, PID: &lt;STRONG&gt;7978&lt;/STRONG&gt; failed&lt;/P&gt;

&lt;P&gt;i am using &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex  "Application:  (?&amp;lt;failedPID&amp;gt;.*) failed" | dedup 1 _time | chart count by failedPID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which is giving me output as&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;MM Viewer, PID: 7988
Database Browser App, PID: 6788
CentralViewer, PID: 7978
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;my ultimate goal is to store Application name in failedApp variable and PID in failedPID avriable.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 10:39:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-two-field-into-two-variable-from-a-single-line-of-log/m-p/411439#M118690</guid>
      <dc:creator>anilkashyap</dc:creator>
      <dc:date>2019-07-31T10:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Extract two field into two variable from a single line of log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-two-field-into-two-variable-from-a-single-line-of-log/m-p/411440#M118691</link>
      <description>&lt;P&gt;@anilkashyap &lt;/P&gt;

&lt;P&gt;Try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex  "Application:\s+(?&amp;lt;failedApp&amp;gt;.+),\s+PID:\s+(?&amp;lt;failedPID&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Jul 2019 11:44:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-two-field-into-two-variable-from-a-single-line-of-log/m-p/411440#M118691</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-07-31T11:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extract two field into two variable from a single line of log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-two-field-into-two-variable-from-a-single-line-of-log/m-p/411441#M118692</link>
      <description>&lt;P&gt;Hi @anilkashyap,&lt;/P&gt;

&lt;P&gt;If this only applies to failed events, then try this : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex  field=_raw  "Application:\s(?&amp;lt;failedApp&amp;gt;.+),\sPID:\s(?&amp;lt;failedPID&amp;gt;\d+)\sfailed"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 11:51:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-two-field-into-two-variable-from-a-single-line-of-log/m-p/411441#M118692</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-07-31T11:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Extract two field into two variable from a single line of log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-two-field-into-two-variable-from-a-single-line-of-log/m-p/411442#M118693</link>
      <description>&lt;P&gt;Hi anilkashyap,&lt;BR /&gt;
you can extract both the fields using one regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "Application:\s+(?&amp;lt;failedApp&amp;gt;[^,]*),\s+PID:\s+(?&amp;lt;failedPID&amp;gt;\d*)\s+failed"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can test it at &lt;A href="https://regex101.com/r/piK2bJ/1"&gt;https://regex101.com/r/piK2bJ/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 12:06:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-two-field-into-two-variable-from-a-single-line-of-log/m-p/411442#M118693</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-07-31T12:06:53Z</dc:date>
    </item>
  </channel>
</rss>

