<?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 to fill a non existing field from other source in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325087#M96956</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;(index=trans_xxx_mycountry sourcetype=trans_xxx_mycountry) OR (index=trans_yyy_all sourcetype=trans_all) OR (index=trans_zzz_all2 sourcetype=trans_all2) TIPO_MENSAJE=* TXID="*" 
 | eval TXID=lower(TXID) 
 |eval CapaFallback="SOMEVALUE"
 | lookup Id_Capas SAT_CAPA as SAT_CAPA OUTPUT CapaResult 
 | eval t=_time 
 |eval Capa=coalesce(CapaResult, CapaFallback)
 | stats values(SOCIEDAD) by TXID,Capa
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Will allow you to set a default value in CapaFallback which gets used if the result of CapaResult is null&lt;/P&gt;</description>
    <pubDate>Fri, 24 Feb 2017 14:45:38 GMT</pubDate>
    <dc:creator>nickhills</dc:creator>
    <dc:date>2017-02-24T14:45:38Z</dc:date>
    <item>
      <title>How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325086#M96955</link>
      <description>&lt;P&gt;Hello everyone, I have this search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=trans_xxx_mycountry sourcetype=trans_xxx_mycountry) OR (index=trans_yyy_all sourcetype=trans_all) OR (index=trans_zzz_all2 sourcetype=trans_all2) TIPO_MENSAJE=* TXID="*" 
| eval TXID=lower(TXID) 
| lookup Id_Capas SAT_CAPA as SAT_CAPA OUTPUT Capa 
| eval t=_time 
| stats values(SOCIEDAD) by TXID,Capa
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get this result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TXID                                   Capa   SOCIEDAD
0457f879-2d1a-4a00-8cc0-b0abda12a04d    1   CL03
0457f879-2d1a-4a00-8cc0-b0abda12a04d    2   CL03
0457f879-2d1a-4a00-8cc0-b0abda12a04d    3   SUCL
0457f879-2d1a-4a00-8cc0-b0abda12a04d    4    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to fill the value "SOCIEDAD" from "Capa=1" or "Capa=2" into the SOCIEDAD from "Capa=4" because the value does not exist there or sometimes is NULL. How can I do that? I've been googling it but I didn't found something similar for me. The TXID is the same in all events but it comes from different sources.  Basically, I want this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TXID                                   Capa   SOCIEDAD
0457f879-2d1a-4a00-8cc0-b0abda12a04d    1   CL03
0457f879-2d1a-4a00-8cc0-b0abda12a04d    2   CL03
0457f879-2d1a-4a00-8cc0-b0abda12a04d    3   SUCL
0457f879-2d1a-4a00-8cc0-b0abda12a04d    4   CL03
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have a solution with a saved search that is writing an external lookup but I want to know if I there is a better way to do that.&lt;/P&gt;

&lt;P&gt;I would appreciate any help. &lt;/P&gt;</description>
      <pubDate>Fri, 24 Feb 2017 14:39:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325086#M96955</guid>
      <dc:creator>jrballesteros05</dc:creator>
      <dc:date>2017-02-24T14:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325087#M96956</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;(index=trans_xxx_mycountry sourcetype=trans_xxx_mycountry) OR (index=trans_yyy_all sourcetype=trans_all) OR (index=trans_zzz_all2 sourcetype=trans_all2) TIPO_MENSAJE=* TXID="*" 
 | eval TXID=lower(TXID) 
 |eval CapaFallback="SOMEVALUE"
 | lookup Id_Capas SAT_CAPA as SAT_CAPA OUTPUT CapaResult 
 | eval t=_time 
 |eval Capa=coalesce(CapaResult, CapaFallback)
 | stats values(SOCIEDAD) by TXID,Capa
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Will allow you to set a default value in CapaFallback which gets used if the result of CapaResult is null&lt;/P&gt;</description>
      <pubDate>Fri, 24 Feb 2017 14:45:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325087#M96956</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2017-02-24T14:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325088#M96957</link>
      <description>&lt;P&gt;Hello, thanks for your reply.&lt;/P&gt;

&lt;P&gt;Sorry if I wasn't clear or if I need to be more specific. &lt;/P&gt;

&lt;P&gt;The field "Capa" is the field I get from the Lookup and is &lt;STRONG&gt;never&lt;/STRONG&gt; NULL. The field "SOCIEDAD" when the value Capa is equal to 4 is &lt;STRONG&gt;always&lt;/STRONG&gt; NULL. &lt;/P&gt;

&lt;P&gt;Basically, I want to fill SOCIEDAD from "Capa =4" with the values of SOCIEDAD from "Capa = 1" or "Capa = 2". &lt;/P&gt;</description>
      <pubDate>Fri, 24 Feb 2017 14:59:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325088#M96957</guid>
      <dc:creator>jrballesteros05</dc:creator>
      <dc:date>2017-02-24T14:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325089#M96958</link>
      <description>&lt;P&gt;sorry your question was good - i misunderstood.&lt;BR /&gt;
will the value of SOCIEDAD be unique per TXID, or could it be a static value?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Feb 2017 15:26:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325089#M96958</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2017-02-24T15:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325090#M96959</link>
      <description>&lt;P&gt;I am struggling to think of a way to do this with out using mkmv. &lt;BR /&gt;
Will either of the two ideas below get you "close" to what you need?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval TXID=lower(TXID) 
 | lookup Id_Capas SAT_CAPA as SAT_CAPA OUTPUT Capa 
 | eval t=_time 
 | stats values(SOCIEDAD) as SOCIEDAD by TXID,Capa
 | fillnull value=SOMEVALUE SOCIEDAD
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Will give:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; TXID Capa SOCIEDAD
0457f879-2d1a-4a00-8cc0-b0abda12a04d 1 CL03
0457f879-2d1a-4a00-8cc0-b0abda12a04d 2 CL03
0457f879-2d1a-4a00-8cc0-b0abda12a04d 3 SUCL
0457f879-2d1a-4a00-8cc0-b0abda12a04d 4 SOMEVALUE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval TXID=lower(TXID) 
 | lookup Id_Capas SAT_CAPA as SAT_CAPA OUTPUT Capa 
 | eval t=_time 
 | stats values(SOCIEDAD) as SOCIEDAD by TXID,Capa
 | filldown SOCIEDAD
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;results in:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TXID Capa SOCIEDAD
0457f879-2d1a-4a00-8cc0-b0abda12a04d 1 CL03
0457f879-2d1a-4a00-8cc0-b0abda12a04d 2 CL03
0457f879-2d1a-4a00-8cc0-b0abda12a04d 3 SUCL
0457f879-2d1a-4a00-8cc0-b0abda12a04d 4 SUCL
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Feb 2017 15:47:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325090#M96959</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2017-02-24T15:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325091#M96960</link>
      <description>&lt;P&gt;Hello. &lt;/P&gt;

&lt;P&gt;The field "SOCIEDAD" is different per country. &lt;/P&gt;

&lt;P&gt;For example: &lt;/P&gt;

&lt;P&gt;SOCIEDAD = CL* or SUCL for Chile. (Where * means any 2 digits number)&lt;BR /&gt;
SOCIEDAD = PE* or SUPE for Peru.&lt;BR /&gt;
SOCIEDAD = CO* or SUPROT for Colombia.&lt;/P&gt;

&lt;P&gt;Sometimes I get this: &lt;/P&gt;

&lt;P&gt;TXID Capa SOCIEDAD&lt;BR /&gt;
0457f879-2d1a-4a00-8cc0-b0abda12a04d 1 CL03&lt;BR /&gt;
0457f879-2d1a-4a00-8cc0-b0abda12a04d 2 CL03&lt;BR /&gt;
&lt;STRONG&gt;0457f879-2d1a-4a00-8cc0-b0abda12a04d 3 SUCL CL03&lt;/STRONG&gt;&lt;BR /&gt;
0457f879-2d1a-4a00-8cc0-b0abda12a04d 4 CL03  &lt;/P&gt;

&lt;P&gt;The mean reason I want to use values from Capa 1 or 2 is because those fields always give me an unique value, on the other hands Capa 3 can give 1 or more values. &lt;/P&gt;</description>
      <pubDate>Fri, 24 Feb 2017 16:06:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325091#M96960</guid>
      <dc:creator>jrballesteros05</dc:creator>
      <dc:date>2017-02-24T16:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325092#M96961</link>
      <description>&lt;P&gt;Hello, I will try this and I'll tell you. &lt;/P&gt;

&lt;P&gt;Thanks for your reply.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Feb 2017 16:35:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325092#M96961</guid>
      <dc:creator>jrballesteros05</dc:creator>
      <dc:date>2017-02-24T16:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325093#M96962</link>
      <description>&lt;P&gt;Hi, I tried both and the second one is the closest to what I need. It worked well until I realised that sometimes logs from Layer 4 (Capa = 4) are indexed first than logs from other layers.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Feb 2017 19:23:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325093#M96962</guid>
      <dc:creator>jrballesteros05</dc:creator>
      <dc:date>2017-02-24T19:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325094#M96963</link>
      <description>&lt;P&gt;You need the &lt;CODE&gt;filldown&lt;/CODE&gt; command:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.2/SearchReference/Filldown"&gt;https://docs.splunk.com/Documentation/Splunk/6.5.2/SearchReference/Filldown&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;So just add this to the end of your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | filldown SOCIEDAD
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Mar 2017 01:23:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325094#M96963</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-01T01:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325095#M96964</link>
      <description>&lt;P&gt;Try this - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (index=trans_xxx_mycountry sourcetype=trans_xxx_mycountry) OR (index=trans_yyy_all sourcetype=trans_all) OR (index=trans_zzz_all2 sourcetype=trans_all2) TIPO_MENSAJE=* TXID="*" 
 | eval TXID=lower(TXID) 
 | lookup Id_Capas SAT_CAPA as SAT_CAPA OUTPUT Capa 
 | eval t=_time 
 | stats values(SOCIEDAD) as SOCIEDAD by TXID,Capa
 | sort 0 capa TXID 
 | eventstats first(SOCIEDAD) as firstCapaSOCIEDAD
 | eval SOCIEDAD=coalesce(SOCIEDAD,firstCapaSOCIEDAD)
 | sort 0 TXID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That solution assumes that "Capa 1" will always sort before any other Capa, so its value for SOCIEDAD will be the first one if the records are sorted in Capa order.  &lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 05:18:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325095#M96964</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-01T05:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325096#M96965</link>
      <description>&lt;P&gt;Hi @woodcock. &lt;/P&gt;

&lt;P&gt;Thank you for your reply. &lt;/P&gt;

&lt;P&gt;I tried filldown in the @nickhillscpl's reply and I got a lot of falses positives with my search. I'm going to try the answer bellow and I hope that can help me. &lt;/P&gt;

&lt;P&gt;Best regards. &lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 18:24:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325096#M96965</guid>
      <dc:creator>jrballesteros05</dc:creator>
      <dc:date>2017-03-02T18:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325097#M96966</link>
      <description>&lt;P&gt;Hello. Thanks for your reply. &lt;/P&gt;

&lt;P&gt;I'm going to try this answer at night or tomorrow in the morning because I don't have access to the Splunk right now and I will tell you what happens.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 18:26:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325097#M96966</guid>
      <dc:creator>jrballesteros05</dc:creator>
      <dc:date>2017-03-02T18:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325098#M96967</link>
      <description>&lt;P&gt;Filldown is useful, but it will give you a repeat of the last value -- the value from record 3 -- rather than a default value pulled from record 1.  &lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 18:57:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325098#M96967</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-02T18:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325099#M96968</link>
      <description>&lt;P&gt;Great.  Best wishes!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 18:57:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325099#M96968</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-02T18:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325100#M96969</link>
      <description>&lt;P&gt;Hello, this is what I wanted!!!&lt;/P&gt;

&lt;P&gt;I just changed this sentence:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventstats first(SOCIEDAD) as firstCapaSOCIEDAD
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for this one: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventstats first(SOCIEDAD) as firstCapaSOCIEDAD by TXID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you very much and also thanks to everybody who takes the time to reply my question. &lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 16:50:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325100#M96969</guid>
      <dc:creator>jrballesteros05</dc:creator>
      <dc:date>2017-03-03T16:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill a non existing field from other source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325101#M96970</link>
      <description>&lt;P&gt;Ah, good catch.  Missed that since there was only 1 TXID in the sample data.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 17:31:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fill-a-non-existing-field-from-other-source/m-p/325101#M96970</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-03T17:31:17Z</dc:date>
    </item>
  </channel>
</rss>

