<?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 can I run the extract command on field extracted by the rex command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-run-the-extract-command-on-field-extracted-by-the-rex/m-p/452652#M128161</link>
    <description>&lt;P&gt;&lt;CODE&gt;rex field=_raw "Container: (?AppropriateRex) (?AppropriateRex) (?AppropriateRex),\{(?AppropriateRex)\}" | spath input=field3 |eval orig_raw = _raw | rename field4 AS _raw | extract | eval _raw = orig_raw&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Mar 2019 04:42:50 GMT</pubDate>
    <dc:creator>sduff_splunk</dc:creator>
    <dc:date>2019-03-29T04:42:50Z</dc:date>
    <item>
      <title>How can I run the extract command on field extracted by the rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-run-the-extract-command-on-field-extracted-by-the-rex/m-p/452649#M128158</link>
      <description>&lt;P&gt;Cog in a larger machine, I have asked my Splunk team to improve the parsing on some of our logs, but it hasn't happened yet, so I need a way to parse complex events in my search.&lt;/P&gt;

&lt;P&gt;I have run my raw event(s) through rex and gotten several fields of interest (eg. field1, field2, field3, field4). Field 3 is a json, which I can then run through spath to get the key:value pairs, but field4 is a different series of key:value pairs (formatted as field-name=[fieldValues]).&lt;/P&gt;

&lt;P&gt;My question is, I run my rex, then I pipe, then I run spath, then... how do I run extract?&lt;/P&gt;

&lt;P&gt;Example event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-03-20 19:25:16.010 Container: 32 Fred {json}, {Date=[some date and time and zone], Another-field=[values=may have; subvalues=with spaces; but no internal closing bracket], and-so-on=[until the last field]}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note: I am trying to keep it all simple other than field4, which is the basis of my question; I am not having a problem with rex, so don't focus on my rex expressions (I won't even put them), but I can easily extract the other fields with rex, as well as the json fields with the spath:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "Container: (?&amp;lt;field1&amp;gt;AppropriateRex) (?&amp;lt;field2&amp;gt;AppropriateRex) (?&amp;lt;field3&amp;gt;AppropriateRex),\{(?&amp;lt;field4&amp;gt;AppropriateRex)\}" | spath input=field3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;so I would get:&lt;/P&gt;

&lt;P&gt;field1=32&lt;BR /&gt;
field2=Fred&lt;BR /&gt;
field3={json}&lt;BR /&gt;
field4&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Date=[some date and time and zone], Another-field=[values=may have; subvalues=with spaces; but no internal closing bracket], and-so-on=[until the last field]&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;and let's say all 50 of the fields from my json are properly extracted via spath. How do I add an "extract" command to get the key:value pairs from field4? I'd like to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| extract input=field4 ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but extract doesn't have an "input" parameter.&lt;/P&gt;

&lt;P&gt;Thank's in advance for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 23:59:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-run-the-extract-command-on-field-extracted-by-the-rex/m-p/452649#M128158</guid>
      <dc:creator>seomaniv</dc:creator>
      <dc:date>2019-03-21T23:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I run the extract command on field extracted by the rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-run-the-extract-command-on-field-extracted-by-the-rex/m-p/452650#M128159</link>
      <description>&lt;P&gt;You can try renaming the field you want to extract from to &lt;CODE&gt;_raw&lt;/CODE&gt; , then run &lt;CODE&gt;extract&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;rex field=_raw "Container: (?&amp;lt;field1&amp;gt;AppropriateRex) (?&amp;lt;field2&amp;gt;AppropriateRex) (?&amp;lt;field3&amp;gt;AppropriateRex),\{(?&amp;lt;field4&amp;gt;AppropriateRex)\}" | spath input=field3 | rename field4 AS _raw | extract&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2019 08:23:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-run-the-extract-command-on-field-extracted-by-the-rex/m-p/452650#M128159</guid>
      <dc:creator>sduff_splunk</dc:creator>
      <dc:date>2019-03-22T08:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: How can I run the extract command on field extracted by the rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-run-the-extract-command-on-field-extracted-by-the-rex/m-p/452651#M128160</link>
      <description>&lt;P&gt;Thank you. This allows the proper extraction of the new fields, as well as keeping the previously extracted fields available, but the event itself is reduced to field4 (I assume because we renamed it as _raw). Is there a way to extract the fields and still display the entire event? For my current needs, I am making a table out of the data to display to non-tech users, so the raw data is not terribly important, but I fear at some point in the future I will regret saying that ...&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2019 17:18:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-run-the-extract-command-on-field-extracted-by-the-rex/m-p/452651#M128160</guid>
      <dc:creator>seomaniv</dc:creator>
      <dc:date>2019-03-25T17:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can I run the extract command on field extracted by the rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-run-the-extract-command-on-field-extracted-by-the-rex/m-p/452652#M128161</link>
      <description>&lt;P&gt;&lt;CODE&gt;rex field=_raw "Container: (?AppropriateRex) (?AppropriateRex) (?AppropriateRex),\{(?AppropriateRex)\}" | spath input=field3 |eval orig_raw = _raw | rename field4 AS _raw | extract | eval _raw = orig_raw&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2019 04:42:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-run-the-extract-command-on-field-extracted-by-the-rex/m-p/452652#M128161</guid>
      <dc:creator>sduff_splunk</dc:creator>
      <dc:date>2019-03-29T04:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can I run the extract command on field extracted by the rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-run-the-extract-command-on-field-extracted-by-the-rex/m-p/452653#M128162</link>
      <description>&lt;P&gt;Thank you, sduff! That worked perfectly!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 22:37:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-run-the-extract-command-on-field-extracted-by-the-rex/m-p/452653#M128162</guid>
      <dc:creator>seomaniv</dc:creator>
      <dc:date>2019-04-02T22:37:45Z</dc:date>
    </item>
  </channel>
</rss>

