<?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 do I use a value in an existing field to create a new field and assign output values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354139#M104808</link>
    <description>&lt;P&gt;I changed &lt;CODE&gt;*&lt;/CODE&gt; to &lt;CODE&gt;.*&lt;/CODE&gt; in the eval and it worked!  &lt;/P&gt;

&lt;P&gt;Thanks so much!&lt;/P&gt;</description>
    <pubDate>Tue, 08 Aug 2017 18:18:12 GMT</pubDate>
    <dc:creator>ejohn</dc:creator>
    <dc:date>2017-08-08T18:18:12Z</dc:date>
    <item>
      <title>How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354132#M104801</link>
      <description>&lt;P&gt;I'm trying to create a new field called TYPE, which is dependent on the word "summary" or "detail" appearing in the TITLE field, so I can then count by TYPE.&lt;/P&gt;

&lt;P&gt;I successfully filtered my logs to identify reports with "summary" or "detail" in the title:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|search(title="*summary*" OR "*detail*")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then, I tried to create TYPE and set its output values to "Report Summary" or "Detailed Report":&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval type=if(match(title,"*summary*"), "Report Summary", match(title, "*detail*"), "Detailed Report")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I also tried doing a field extraction, but the title field does not appear in the Select Fields box to be highlighted.&lt;/P&gt;

&lt;P&gt;I'm stuck.  Please help!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2017 20:08:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354132#M104801</guid>
      <dc:creator>ejohn</dc:creator>
      <dc:date>2017-08-07T20:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354133#M104802</link>
      <description>&lt;P&gt;Match uses regular expressions so &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* matches * and .* matches everything 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Try this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval type=if(match(title,".*summary.*"),"Report Summary",if(match(title, ".*detail.*"),"Detailed Report","Unknown Type"))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Aug 2017 22:22:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354133#M104802</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-08-07T22:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354134#M104803</link>
      <description>&lt;P&gt;Your stacked &lt;CODE&gt;if&lt;/CODE&gt; should really be a &lt;CODE&gt;case&lt;/CODE&gt; and your RegEx like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=YouShouldAlwaysSpeciryAnIndex sourcetype=AndSourcetypeToo title="*summary*" OR "*detail*"
| eval type=case(match(title, "(?i)summary"), "Report Summary",
                 match(title, "(?i)detail"), "Detailed Report",
                 true(), "THIS SHOULD NEVER EVER HAPPEN")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Aug 2017 22:43:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354134#M104803</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-08-07T22:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354135#M104804</link>
      <description>&lt;P&gt;Thanks for the quick response!  &lt;/P&gt;

&lt;P&gt;I tried this with * and with .* for wildcards, but I get the following error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  Error in 'eval' command: The arguments  to the 'searchmatch' function are invalid.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Aug 2017 00:35:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354135#M104804</guid>
      <dc:creator>ejohn</dc:creator>
      <dc:date>2017-08-08T00:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354136#M104805</link>
      <description>&lt;P&gt;Thanks for responding so quickly!&lt;/P&gt;

&lt;P&gt;This is creating the TYPE field, but it's only returning the value "unknown type".  Could this have something to do with special characters in the titles?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 00:39:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354136#M104805</guid>
      <dc:creator>ejohn</dc:creator>
      <dc:date>2017-08-08T00:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354137#M104806</link>
      <description>&lt;P&gt;As long as the titles are have lowercase summary or detail, it should work fine.&lt;/P&gt;

&lt;P&gt;If summary can be upper or lower you can do this instead&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  .*[sS][uU][mM][mM][aA][rR][yY].*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Same syntax for details.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 11:16:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354137#M104806</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-08-08T11:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354138#M104807</link>
      <description>&lt;P&gt;I was adding features to &lt;CODE&gt;searchmatch&lt;/CODE&gt; in my mind!  Try updated answer instead.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 14:41:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354138#M104807</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-08-08T14:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354139#M104808</link>
      <description>&lt;P&gt;I changed &lt;CODE&gt;*&lt;/CODE&gt; to &lt;CODE&gt;.*&lt;/CODE&gt; in the eval and it worked!  &lt;/P&gt;

&lt;P&gt;Thanks so much!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 18:18:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354139#M104808</guid>
      <dc:creator>ejohn</dc:creator>
      <dc:date>2017-08-08T18:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354140#M104809</link>
      <description>&lt;P&gt;Once I capitalized summary and detail it worked.  Now I know how to account for upper and lower too.  &lt;/P&gt;

&lt;P&gt;Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 18:24:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354140#M104809</guid>
      <dc:creator>ejohn</dc:creator>
      <dc:date>2017-08-08T18:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354141#M104810</link>
      <description>&lt;P&gt;@ejohn - if it worked, please "accept" the answer so the question will show as complete.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 18:34:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354141#M104810</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-08T18:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354142#M104811</link>
      <description>&lt;P&gt;ARGH!  You are right again.  That's what I get for writing RegEx in my head.  I will fix the original answer (the right answer is to not have the asterisks at all).&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 19:01:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354142#M104811</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-08-08T19:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354143#M104812</link>
      <description>&lt;P&gt;@ejohn, since both answers worked, why don't you choose the one that runs the quickest, or consumes the least CPU/RAM or whatever you like, and then mark it as the answer and upvote both?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 22:17:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354143#M104812</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-08-08T22:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354144#M104813</link>
      <description>&lt;P&gt;@jkat54, thanks for the suggestion.  I decided to accept the answer with the higher EPS.&lt;/P&gt;

&lt;P&gt;Adding each &lt;CODE&gt;eval&lt;/CODE&gt; to the rest of my search against 10 months of logs in Verbose mode:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;|eval type=case(match(title...)&lt;/CODE&gt; returned &lt;STRONG&gt;14,190 EPS&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;and &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;|eval type=if(match(title...)&lt;/CODE&gt;returned 13,408 EPS&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 18:37:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354144#M104813</guid>
      <dc:creator>ejohn</dc:creator>
      <dc:date>2017-08-10T18:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354145#M104814</link>
      <description>&lt;P&gt;That worked too!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 18:52:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354145#M104814</guid>
      <dc:creator>ejohn</dc:creator>
      <dc:date>2017-08-10T18:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354146#M104815</link>
      <description>&lt;P&gt;@jkat54 and @woodcock this is my first real attempt a crowdsourcing and I like it!  You guys have been awesome!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 18:53:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354146#M104815</guid>
      <dc:creator>ejohn</dc:creator>
      <dc:date>2017-08-10T18:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a value in an existing field to create a new field and assign output values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354147#M104816</link>
      <description>&lt;P&gt;Hey @ejohn, anytime sir!  That's what we do.  Feel free to tag us when needed.  @woodcock almost always has the best answer but I keep trying!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 23:00:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-value-in-an-existing-field-to-create-a-new-field/m-p/354147#M104816</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-08-10T23:00:39Z</dc:date>
    </item>
  </channel>
</rss>

