<?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 How to extract many fields with a single regular expression ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-many-fields-with-a-single-regular-expression/m-p/456218#M168188</link>
    <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I have a sample log file as shown in the attached screenshot.&lt;BR /&gt;
I have many such tags in the log file. I want to extract all time delay tags as a separate filed. It will be a tedious task to write separate regular expression for each tag. Is there any way to extract all the tags with single regular expression ? &lt;BR /&gt;
How can i achieve this ?&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5417i46E455C75C1EA8BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jul 2018 06:10:59 GMT</pubDate>
    <dc:creator>Allampally</dc:creator>
    <dc:date>2018-07-24T06:10:59Z</dc:date>
    <item>
      <title>How to extract many fields with a single regular expression ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-many-fields-with-a-single-regular-expression/m-p/456218#M168188</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I have a sample log file as shown in the attached screenshot.&lt;BR /&gt;
I have many such tags in the log file. I want to extract all time delay tags as a separate filed. It will be a tedious task to write separate regular expression for each tag. Is there any way to extract all the tags with single regular expression ? &lt;BR /&gt;
How can i achieve this ?&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5417i46E455C75C1EA8BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 06:10:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-many-fields-with-a-single-regular-expression/m-p/456218#M168188</guid>
      <dc:creator>Allampally</dc:creator>
      <dc:date>2018-07-24T06:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract many fields with a single regular expression ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-many-fields-with-a-single-regular-expression/m-p/456219#M168189</link>
      <description>&lt;P&gt;@Allampally &lt;BR /&gt;
Instead of screenshot.. Can you kindly post log sample here. &lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 06:41:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-many-fields-with-a-single-regular-expression/m-p/456219#M168189</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2018-07-24T06:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract many fields with a single regular expression ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-many-fields-with-a-single-regular-expression/m-p/456220#M168190</link>
      <description>&lt;P&gt;@Allampally, If your raw data is xml you can use &lt;CODE&gt;KV_MODE=xml&lt;/CODE&gt; in your &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf"&gt;props.conf&lt;/A&gt; to extract all xml nodes at search time field discovery.&lt;/P&gt;

&lt;P&gt;Alternatively you can can use &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath"&gt;spath&lt;/A&gt; command with your xml data, which should extract all xml nodes similar to above approach.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourCurrentSearch&amp;gt;
| spath
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you need Regex based extraction (Search Time using SPL or Transform) you can refer to the following answer for generic Regular Expression for extracting KV Pair from XML: &lt;A href="https://answers.splunk.com/answers/2889/automatically-extract-xml-key-value-pairs.html"&gt;https://answers.splunk.com/answers/2889/automatically-extract-xml-key-value-pairs.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 07:00:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-many-fields-with-a-single-regular-expression/m-p/456220#M168190</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-07-24T07:00:17Z</dc:date>
    </item>
  </channel>
</rss>

