<?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: extract from calculated field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/extract-from-calculated-field/m-p/61983#M15301</link>
    <description>&lt;P&gt;It is likely that &lt;CODE&gt;EXTRACT&lt;/CODE&gt;s all run before &lt;CODE&gt;EVAL&lt;/CODE&gt;s, so you would not be able to extract this way. However, you may be able to instead use &lt;CODE&gt;REPORT&lt;/CODE&gt;/transforms.conf to extract from &lt;CODE&gt;EVAL&lt;/CODE&gt;. &lt;CODE&gt;REPORT&lt;/CODE&gt;s run after &lt;CODE&gt;EXTRACT&lt;/CODE&gt;s, but I do not know if they run after &lt;CODE&gt;EVAL&lt;/CODE&gt;s. If they do, you should be able to use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REPORT-url_path = url_path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and in transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[url_path]
SOURCE_KEY = url
REGEX = (?&amp;lt;url_path&amp;gt;.?)(?|$)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in place of the corresponding &lt;CODE&gt;EXTRACT&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Dec 2012 06:03:27 GMT</pubDate>
    <dc:creator>gkanapathy</dc:creator>
    <dc:date>2012-12-13T06:03:27Z</dc:date>
    <item>
      <title>extract from calculated field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-from-calculated-field/m-p/61982#M15300</link>
      <description>&lt;P&gt;I can't find anything that says you can't do a field extraction from a calculated field, but I found that this works in props.conf:&lt;/P&gt;

&lt;P&gt;[psft_weblogic_access]&lt;BR /&gt;
EVAL-url = urldecode(url_encoded)&lt;BR /&gt;
EXTRACT-url_encoded = (GET|POST)\s(?P&lt;URL_ENCODED&gt;.&lt;EM&gt;?)\s&lt;BR /&gt;
EXTRACT-url_path = (?P&lt;URL_PATH&gt;.&lt;/URL_PATH&gt;&lt;/EM&gt;?)(\?|$) in url_encoded&lt;/URL_ENCODED&gt;&lt;/P&gt;

&lt;P&gt;but this does not work--url_path is not extracted:&lt;/P&gt;

&lt;P&gt;[psft_weblogic_access]&lt;BR /&gt;
EVAL-url = urldecode(url_encoded)&lt;BR /&gt;
EXTRACT-url_encoded = (GET|POST)\s(?P&lt;URL_ENCODED&gt;.&lt;EM&gt;?)\s&lt;BR /&gt;
EXTRACT-url_path = (?P&lt;URL_PATH&gt;.&lt;/URL_PATH&gt;&lt;/EM&gt;?)(\?|$) in url&lt;/URL_ENCODED&gt;&lt;/P&gt;

&lt;P&gt;Is that a limitation?&lt;/P&gt;

&lt;P&gt;(url_path is meant to grab everything up to the first "?" or to the end of the url.)&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:57:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-from-calculated-field/m-p/61982#M15300</guid>
      <dc:creator>pwattssplunk</dc:creator>
      <dc:date>2020-09-28T12:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: extract from calculated field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-from-calculated-field/m-p/61983#M15301</link>
      <description>&lt;P&gt;It is likely that &lt;CODE&gt;EXTRACT&lt;/CODE&gt;s all run before &lt;CODE&gt;EVAL&lt;/CODE&gt;s, so you would not be able to extract this way. However, you may be able to instead use &lt;CODE&gt;REPORT&lt;/CODE&gt;/transforms.conf to extract from &lt;CODE&gt;EVAL&lt;/CODE&gt;. &lt;CODE&gt;REPORT&lt;/CODE&gt;s run after &lt;CODE&gt;EXTRACT&lt;/CODE&gt;s, but I do not know if they run after &lt;CODE&gt;EVAL&lt;/CODE&gt;s. If they do, you should be able to use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REPORT-url_path = url_path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and in transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[url_path]
SOURCE_KEY = url
REGEX = (?&amp;lt;url_path&amp;gt;.?)(?|$)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in place of the corresponding &lt;CODE&gt;EXTRACT&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2012 06:03:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-from-calculated-field/m-p/61983#M15301</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2012-12-13T06:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: extract from calculated field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-from-calculated-field/m-p/61984#M15302</link>
      <description>&lt;P&gt;Calculated fields happen after field aliasing (which happens after ALL field extractions) but before lookups. What you're observing here is the correct behavior and not a limitation. &lt;CODE&gt;eval&lt;/CODE&gt; is flexible enough to allow you to wrangle and mold field/strings to the desired shape.  Your first example "works" because you're not extracting anything from &lt;CODE&gt;url&lt;/CODE&gt; after it is calculated. Your second example, as expected, does not work because you're trying to extract from an EVALed field. &lt;/P&gt;

&lt;P&gt;Also, note that you can't EVAL an EVALed field, but nothing prevents you from making your eval statement as complex as necessary: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[psft_weblogic_access] &lt;BR /&gt;
EVAL-url_path = replace(urldecode(url_encoded), "([^?]+).*$", "\1")&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;d.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Dec 2012 03:13:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-from-calculated-field/m-p/61984#M15302</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2012-12-16T03:13:48Z</dc:date>
    </item>
  </channel>
</rss>

