<?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: Dealing with multiple fields from different sourcetype that have the same name in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221465#M188162</link>
    <description>&lt;P&gt;Hey Kavey,&lt;/P&gt;

&lt;P&gt;Take a look at the append command &lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Append"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Append&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You could do a subsearch to retrieve Z from sourcetype B.&lt;/P&gt;</description>
    <pubDate>Mon, 25 Apr 2016 09:09:02 GMT</pubDate>
    <dc:creator>ktugwell_splunk</dc:creator>
    <dc:date>2016-04-25T09:09:02Z</dc:date>
    <item>
      <title>Dealing with multiple fields from different sourcetype that have the same name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221464#M188161</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;here is my problem : I have a sourcetype A with a field X and Z and a sourcetype B with a field Y and Z. The thing I would like to do is using the field X and Z of sourcetype A and field Y of sourcetype B.&lt;/P&gt;

&lt;P&gt;What is the simplest way to achieve this? &lt;/P&gt;

&lt;P&gt;Thank you in advance for helping me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 08:41:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221464#M188161</guid>
      <dc:creator>Kavey</dc:creator>
      <dc:date>2016-04-25T08:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with multiple fields from different sourcetype that have the same name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221465#M188162</link>
      <description>&lt;P&gt;Hey Kavey,&lt;/P&gt;

&lt;P&gt;Take a look at the append command &lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Append"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Append&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You could do a subsearch to retrieve Z from sourcetype B.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 09:09:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221465#M188162</guid>
      <dc:creator>ktugwell_splunk</dc:creator>
      <dc:date>2016-04-25T09:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with multiple fields from different sourcetype that have the same name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221466#M188163</link>
      <description>&lt;P&gt;Hi, thanks for replying! &lt;/P&gt;

&lt;P&gt;I already thought about it but I would like not to use a subsearch since it will affect the performance... Moreover the number of events that could be returned might be big&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 09:27:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221466#M188163</guid>
      <dc:creator>Kavey</dc:creator>
      <dc:date>2016-04-25T09:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with multiple fields from different sourcetype that have the same name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221467#M188164</link>
      <description>&lt;P&gt;How about using eval to generate a new field identifying which sourcetype the data comes from?&lt;/P&gt;

&lt;P&gt;... | eval Z1=IF(sourcetype=A, Z, NULL) | eval Z2=IF(sourcetype=B, Z, NULL)&lt;/P&gt;

&lt;P&gt;Will that work for you?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 09:33:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221467#M188164</guid>
      <dc:creator>ktugwell_splunk</dc:creator>
      <dc:date>2016-04-25T09:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with multiple fields from different sourcetype that have the same name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221468#M188165</link>
      <description>&lt;P&gt;How about creating a field alias of the field Y of the sourcetype B?&lt;BR /&gt;
Then it would have a different name and you will be able to do what you want.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 09:34:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221468#M188165</guid>
      <dc:creator>ctaf</dc:creator>
      <dc:date>2016-04-25T09:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with multiple fields from different sourcetype that have the same name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221469#M188166</link>
      <description>&lt;P&gt;You could use a field aliases for sourcetype B and rename fields, so that they don't have same names across your sourcetypes.&lt;/P&gt;

&lt;P&gt;settings -&amp;gt; fields -&amp;gt; field aliases&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 09:37:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221469#M188166</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2016-04-25T09:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with multiple fields from different sourcetype that have the same name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221470#M188167</link>
      <description>&lt;P&gt;Thank you I didn't know about that feature it is indeed what I was looking for. However is there any other way to do this simply within the query ? &lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 09:50:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221470#M188167</guid>
      <dc:creator>Kavey</dc:creator>
      <dc:date>2016-04-25T09:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with multiple fields from different sourcetype that have the same name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221471#M188168</link>
      <description>&lt;P&gt;You could also use eval &amp;amp; if to target specific sourcetypes&lt;/P&gt;

&lt;P&gt;Like here in a stats command&lt;/P&gt;

&lt;P&gt;... | stats sum(eval(if(sourcetype="A", Z, null()))) AS result&lt;/P&gt;

&lt;P&gt;This sums up all values for Z if sourcetype="A"&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 09:59:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221471#M188168</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2016-04-25T09:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with multiple fields from different sourcetype that have the same name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221472#M188169</link>
      <description>&lt;P&gt;Another way to easily differentiate field names dynamically is by using the following syntax:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval yourfieldname-{sourcetype} = yourfieldname
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For instance, if you have a field Z in both sourcetype A and sourcetype B, you could do the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval fieldZ-{sourcetype} = fieldZ
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And Splunk will dynamically create the following two fields for you based on the value of your sourcetype:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;fieldZ-sourcetypeA
fieldZ-sourcetypeB
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If there were more sourcetypes added later on this would still work.&lt;BR /&gt;
Hope that helps.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 10:54:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221472#M188169</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-04-25T10:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with multiple fields from different sourcetype that have the same name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221473#M188170</link>
      <description>&lt;P&gt;Thanks, that method helped too! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 11:13:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221473#M188170</guid>
      <dc:creator>Kavey</dc:creator>
      <dc:date>2016-04-25T11:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with multiple fields from different sourcetype that have the same name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221474#M188171</link>
      <description>&lt;P&gt;I didn't choose that method but it is a way to achieve what I want, thank you&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 13:00:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dealing-with-multiple-fields-from-different-sourcetype-that-have/m-p/221474#M188171</guid>
      <dc:creator>Kavey</dc:creator>
      <dc:date>2016-04-25T13:00:36Z</dc:date>
    </item>
  </channel>
</rss>

