<?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: Set a field to a value when it may or may not exist exist in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237706#M46175</link>
    <description>&lt;P&gt;Hi Rich,&lt;BR /&gt;
Thanks for the rapid response. In the short term I will use your solution but I was hoping that I could add it to my props.conf file e.g. "EXTRACT-Logon_Status = (some_convoluted_reg_expression).&lt;/P&gt;

&lt;P&gt;Appreciate your help,&lt;BR /&gt;
Mark.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 07:21:46 GMT</pubDate>
    <dc:creator>markwymer</dc:creator>
    <dc:date>2020-09-29T07:21:46Z</dc:date>
    <item>
      <title>Set a field to a value when it may or may not exist exist</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237703#M46172</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
We have a specific logon event message that only has the word 'errorcode' if the logon fails - there is nothing to indicate a successful logon. A logon failure event looks something like &lt;STRONG&gt;|HDR+1|TIME+2015-09-22 22:14:57.646 GMT|DATA++LOGON:&lt;/STRONG&gt;&lt;EM&gt;111.111.111.11:app name:&lt;/EM&gt;&lt;STRONG&gt;deviceType-&lt;/STRONG&gt;&lt;EM&gt;iPhone&lt;/EM&gt;,&lt;STRONG&gt;deviceVersion&lt;/STRONG&gt;-&lt;EM&gt;8.3&lt;/EM&gt;,,,,connection-2,,&lt;A href="mailto:membershipNumber-username@domain.com" target="_blank"&gt;membershipNumber-username@domain.com&lt;/A&gt;,,,,&lt;STRONG&gt;errorcode&lt;/STRONG&gt;-MOB21038&lt;/P&gt;

&lt;P&gt;A successful logon would be the same but without the last "error code" message.&lt;BR /&gt;
If I was doing this in a shell script, I would do something like:-&lt;/P&gt;

&lt;P&gt;if [ &lt;CODE&gt;echo $event | grep -c "errorcode"&lt;/CODE&gt; -eq 1 ] ; then&lt;BR /&gt;
    Logon_Status="Failed"&lt;BR /&gt;
else&lt;BR /&gt;
   Logon_Status="Successful"&lt;BR /&gt;
fi&lt;/P&gt;

&lt;P&gt;My question is, what would the FIELD EXTRACT look like in the props.con file to set Logon_Status to either "Successful" or "Failed" &lt;/P&gt;

&lt;P&gt;(n.b. I can get the Logon_Status=Failed quite happily - it's just the other bit that has me stumped!)&lt;/P&gt;

&lt;P&gt;Many thanks for any and all help,&lt;BR /&gt;
Mark.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:21:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237703#M46172</guid>
      <dc:creator>markwymer</dc:creator>
      <dc:date>2020-09-29T07:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Set a field to a value when it may or may not exist exist</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237704#M46173</link>
      <description>&lt;P&gt;Something like this should get you started.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your event search&amp;gt; | eval Logon_Status=if(isnull(errorcode),"Successful","Failed") | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Sep 2015 04:23:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237704#M46173</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-09-23T04:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Set a field to a value when it may or may not exist exist</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237705#M46174</link>
      <description>&lt;P&gt;Hi Rich,&lt;BR /&gt;
Thanks for the rapid response. In the short term I will use your solution but I was hoping that I could add it to my props.conf file e.g. "EXTRACT-Logon_Status = (some_convoluted_reg_expression).&lt;/P&gt;

&lt;P&gt;Appreciate your help,&lt;BR /&gt;
Mark.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:21:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237705#M46174</guid>
      <dc:creator>markwymer</dc:creator>
      <dc:date>2020-09-29T07:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Set a field to a value when it may or may not exist exist</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237706#M46175</link>
      <description>&lt;P&gt;Hi Rich,&lt;BR /&gt;
Thanks for the rapid response. In the short term I will use your solution but I was hoping that I could add it to my props.conf file e.g. "EXTRACT-Logon_Status = (some_convoluted_reg_expression).&lt;/P&gt;

&lt;P&gt;Appreciate your help,&lt;BR /&gt;
Mark.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:21:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237706#M46175</guid>
      <dc:creator>markwymer</dc:creator>
      <dc:date>2020-09-29T07:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: Set a field to a value when it may or may not exist exist</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237707#M46176</link>
      <description>&lt;P&gt;I'm not aware of any convoluted regexes that can find something that isn't there.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2015 13:59:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237707#M46176</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-09-23T13:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Set a field to a value when it may or may not exist exist</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237708#M46177</link>
      <description>&lt;P&gt;You should be able to add this eval statement in your props.conf as calculated fields, like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EVAL-Logon_Status=if(isnull(errorcode),"Successful","Failed") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Sep 2015 14:19:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237708#M46177</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-23T14:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Set a field to a value when it may or may not exist exist</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237709#M46178</link>
      <description>&lt;P&gt;I forgot about calculated fields.  Good suggestion!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 15:08:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237709#M46178</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-09-24T15:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: Set a field to a value when it may or may not exist exist</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237710#M46179</link>
      <description>&lt;P&gt;I forgot about calculated fields.  Good suggestion!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 15:09:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-a-field-to-a-value-when-it-may-or-may-not-exist-exist/m-p/237710#M46179</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-09-24T15:09:43Z</dc:date>
    </item>
  </channel>
</rss>

