<?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 How to assign fields to event/logs which do not contain target string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-assign-fields-to-event-logs-which-do-not-contain-target/m-p/315672#M94488</link>
    <description>&lt;P&gt;I have two applications, these can exist in preprod or live environments. I want to have a field on logs from both applications called "environment", which is set to LIVE if it is in the live environment.&lt;/P&gt;

&lt;P&gt;Using field extractions I am able to extract whether a URI is from a live or preprod server for &lt;STRONG&gt;Application A&lt;/STRONG&gt; by extracting LIVE when it appears in the URI and putting it into a field. This is easy as LIVE URIs include the string LIVE.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;regex to match start of URI&lt;/EM&gt;... &lt;STRONG&gt;(?P(?i)(LIVE))&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;For &lt;STRONG&gt;Application B&lt;/STRONG&gt; it is different, PREPROD URIs are marked PREPROD, and LIVE versions are unmarked. However, for consistency between applications, I'd like to put a live field on to the live URIs. As there is no longer a 'LIVE' string to extract from the live URIs (live URIs for this app are shown by a lack of PREPROD), I'm not sure how to do this with a regex field extraction. I need to basically detect logs which do not contain preprod, and create a new field on them, named environment, populated with the value 'live'.&lt;/P&gt;</description>
    <pubDate>Fri, 07 Apr 2017 15:16:39 GMT</pubDate>
    <dc:creator>JpAnderson_2</dc:creator>
    <dc:date>2017-04-07T15:16:39Z</dc:date>
    <item>
      <title>How to assign fields to event/logs which do not contain target string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-assign-fields-to-event-logs-which-do-not-contain-target/m-p/315672#M94488</link>
      <description>&lt;P&gt;I have two applications, these can exist in preprod or live environments. I want to have a field on logs from both applications called "environment", which is set to LIVE if it is in the live environment.&lt;/P&gt;

&lt;P&gt;Using field extractions I am able to extract whether a URI is from a live or preprod server for &lt;STRONG&gt;Application A&lt;/STRONG&gt; by extracting LIVE when it appears in the URI and putting it into a field. This is easy as LIVE URIs include the string LIVE.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;regex to match start of URI&lt;/EM&gt;... &lt;STRONG&gt;(?P(?i)(LIVE))&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;For &lt;STRONG&gt;Application B&lt;/STRONG&gt; it is different, PREPROD URIs are marked PREPROD, and LIVE versions are unmarked. However, for consistency between applications, I'd like to put a live field on to the live URIs. As there is no longer a 'LIVE' string to extract from the live URIs (live URIs for this app are shown by a lack of PREPROD), I'm not sure how to do this with a regex field extraction. I need to basically detect logs which do not contain preprod, and create a new field on them, named environment, populated with the value 'live'.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 15:16:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-assign-fields-to-event-logs-which-do-not-contain-target/m-p/315672#M94488</guid>
      <dc:creator>JpAnderson_2</dc:creator>
      <dc:date>2017-04-07T15:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign fields to event/logs which do not contain target string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-assign-fields-to-event-logs-which-do-not-contain-target/m-p/315673#M94489</link>
      <description>&lt;P&gt;How are you distinguishing between log records that come from one application and those that come from the other? Do they have different sourcetypes, or another major distinguishing characteristic at index time?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 15:42:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-assign-fields-to-event-logs-which-do-not-contain-target/m-p/315673#M94489</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-04-07T15:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign fields to event/logs which do not contain target string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-assign-fields-to-event-logs-which-do-not-contain-target/m-p/315674#M94490</link>
      <description>&lt;P&gt;There is another field for app_name extracted in a series of separate field extractions. It is extracted from the URI in an IIS log.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 15:45:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-assign-fields-to-event-logs-which-do-not-contain-target/m-p/315674#M94490</guid>
      <dc:creator>JpAnderson_2</dc:creator>
      <dc:date>2017-04-07T15:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign fields to event/logs which do not contain target string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-assign-fields-to-event-logs-which-do-not-contain-target/m-p/315675#M94491</link>
      <description>&lt;P&gt;Okay, it can be done.  Extractions are not really designed to be "programmed", but you can usually make it happen.  &lt;/P&gt;

&lt;P&gt;There may be a more elegant way, but as long as you can get the rules to operate in this exact order, then here's some pseudocode on how you can do it, in four rules. &lt;/P&gt;

&lt;P&gt;1) extract the appname&lt;BR /&gt;
2) if appname matches app A, set environment  to PREPROD&lt;BR /&gt;
3) if appname matches app B, set environment to LIVE&lt;BR /&gt;
4) if URI contains LIVE or PREPROD, set environment to that value&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 16:11:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-assign-fields-to-event-logs-which-do-not-contain-target/m-p/315675#M94491</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-04-07T16:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign fields to event/logs which do not contain target string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-assign-fields-to-event-logs-which-do-not-contain-target/m-p/315676#M94492</link>
      <description>&lt;P&gt;Thanks for the answer. Is this all done with field extractions? For example how would I do step 1, set environment in the same extraction which sets the app name?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 10:24:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-assign-fields-to-event-logs-which-do-not-contain-target/m-p/315676#M94492</guid>
      <dc:creator>JpAnderson_2</dc:creator>
      <dc:date>2017-04-11T10:24:25Z</dc:date>
    </item>
  </channel>
</rss>

