<?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: Field extractions with default value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181874#M52408</link>
    <description>&lt;P&gt;Thanks, just what the doctor ordered! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Dec 2013 00:25:44 GMT</pubDate>
    <dc:creator>ltruesda</dc:creator>
    <dc:date>2013-12-19T00:25:44Z</dc:date>
    <item>
      <title>Field extractions with default value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181867#M52401</link>
      <description>&lt;P&gt;Can a field extraction be devised so that it has a default value when the regex is not matched?&lt;/P&gt;

&lt;P&gt;I have defined an extracted field based on a regex which matches a specific pattern in an event.  The resulting field will contain the matched data if it was present and the field will not exist for an event where the pattern was not matched.  &lt;/P&gt;

&lt;P&gt;All that is good.&lt;/P&gt;

&lt;P&gt;However, for the cases where the pattern did not match, I would rather the field exist and contain a hyphen ("-").  &lt;/P&gt;

&lt;P&gt;Within the confines of a field extraction, is there a way to do this?  I know I could use fillnull to add the hyphens later, but I'd prefer a more elegant solution.  &lt;/P&gt;

&lt;P&gt;In no solution exists, I can live with it, but if I can have this, it would streamline my searching.  &lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2013 20:43:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181867#M52401</guid>
      <dc:creator>ltruesda</dc:creator>
      <dc:date>2013-12-17T20:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions with default value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181868#M52402</link>
      <description>&lt;P&gt;You can simply use the command fillnull at search time to get what you want. &lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0/SearchReference/fillnull"&gt;http://docs.splunk.com/Documentation/Splunk/6.0/SearchReference/fillnull&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Like so:&lt;/P&gt;

&lt;P&gt;&lt;YOUR_BASE_SEARCH&gt; | fillnull value="-" &lt;YOUR_FIELD&gt;&lt;/YOUR_FIELD&gt;&lt;/YOUR_BASE_SEARCH&gt;&lt;/P&gt;

&lt;P&gt;Where &lt;YOUR_FIELD&gt; needs to be the field that you want to add hyphens instead of not having the field.&lt;/YOUR_FIELD&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2013 20:58:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181868#M52402</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2013-12-17T20:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions with default value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181869#M52403</link>
      <description>&lt;P&gt;I converted your comment into an answer - if it's an answer please put it in as one &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2013 21:08:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181869#M52403</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-12-17T21:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions with default value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181870#M52404</link>
      <description>&lt;P&gt;Fair enough @Ayn &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2013 21:43:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181870#M52404</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2013-12-17T21:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions with default value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181871#M52405</link>
      <description>&lt;P&gt;As mentioned in my question I knew about this possibility.  But I am hoping to have this populated at extraction time and simplify my searches.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2013 21:51:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181871#M52405</guid>
      <dc:creator>ltruesda</dc:creator>
      <dc:date>2013-12-17T21:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions with default value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181872#M52406</link>
      <description>&lt;P&gt;You could use &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0/Knowledge/definecalcfields"&gt;calculated fields&lt;/A&gt; if you want to avoid using searches to populate the value.&lt;/P&gt;

&lt;P&gt;In this snippet from props.conf, bytes_out will always be populated to 0 if it was null:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[somesourcetype]
EVAL-bytes_out = if(isnull(bytes_out),0,bytes_out)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The normal &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0/SearchReference/CommonEvalFunctions"&gt;eval functions&lt;/A&gt; should work. Note that calculated fields was included starting with Splunk 5.0 so it won't work on 4.X or earlier.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2013 06:37:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181872#M52406</guid>
      <dc:creator>LukeMurphey</dc:creator>
      <dc:date>2013-12-18T06:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions with default value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181873#M52407</link>
      <description>&lt;P&gt;Guess I should read peoples questions more carefully &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Take a look at Luke's answer. Looks promising.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2013 14:09:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181873#M52407</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2013-12-18T14:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions with default value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181874#M52408</link>
      <description>&lt;P&gt;Thanks, just what the doctor ordered! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2013 00:25:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-with-default-value/m-p/181874#M52408</guid>
      <dc:creator>ltruesda</dc:creator>
      <dc:date>2013-12-19T00:25:44Z</dc:date>
    </item>
  </channel>
</rss>

