<?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: Search From Two Indexes. Applying A Name Referenced By Id On Both Searches. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-From-Two-Indexes-Applying-A-Name-Referenced-By-Id-On-Both/m-p/438594#M124836</link>
    <description>&lt;P&gt;index="cloudwatch" metric_name=CPUUtilization index="description" | spath output="dInstanceId" id | search id="i-*" | spath output="dInstanceName" "tags.Name"&lt;/P&gt;

&lt;P&gt;| rex field=metric_dimensions "^(?(\bInstanceId=.*\b))"&lt;BR /&gt;
 | eval cwInstanceId = trim(replace(cwInstanceId, "InstanceId=[", ""))&lt;/P&gt;

&lt;P&gt;|dedup dInstanceName &lt;/P&gt;

&lt;P&gt;| stats count by  dInstanceId, dInstanceName, _time &lt;BR /&gt;
|fields  dInstanceName, _time &lt;/P&gt;</description>
    <pubDate>Fri, 21 Dec 2018 20:26:59 GMT</pubDate>
    <dc:creator>valiquet</dc:creator>
    <dc:date>2018-12-21T20:26:59Z</dc:date>
    <item>
      <title>Search From Two Indexes. Applying A Name Referenced By Id On Both Searches.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-From-Two-Indexes-Applying-A-Name-Referenced-By-Id-On-Both/m-p/438590#M124832</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;

&lt;P&gt;Hoping someone could help me out. I'm currently using the AWS Add-On For Splunk and I wanted to expand the EC2 CPU Usage template that was provided  (my 2nd search example below) . I've adjusted it a bit to provide me a list of instance ids in a timechart format. This works great, however I wanted to try to cross-reference it with another search that could give me the "name" tag of the EC2 using another index rather than the id.&lt;/P&gt;

&lt;P&gt;1st search - This search gives me a list of "instanceids" and "names"&lt;/P&gt;

&lt;P&gt;i-123456789, server1&lt;BR /&gt;
i-234567890, server 2&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="description" | spath output="dInstanceId" id | search id="i-*" | spath output="dInstanceName" "tags.Name" | search "tags.Name"="*"
|dedup dInstanceName 
|table dInstanceId, dInstanceName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2nd search - This search gives me the CPU Utilization metric.&lt;/P&gt;

&lt;P&gt;i-123456789&lt;BR /&gt;
2018-12-16 11:00:00     0.50&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="cloudwatch" metric_name=CPUUtilization
| rex field=metric_dimensions "^(?&amp;lt;cwInstanceId&amp;gt;(\bInstanceId=.*\b))"
| eval cwInstanceId = trim(replace(cwInstanceId, "InstanceId=\[", ""))
| timechart eval(round(avg(Average),2)) by cwInstanceId where max in top10
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My end goal is to have it reference the 1st search and provide a:&lt;/P&gt;

&lt;P&gt;server1&lt;BR /&gt;
2018-12-16 11:00:00 0.50&lt;/P&gt;

&lt;P&gt;I attempted trying to cross-compare with an appended search without any luck. Would a join be used in this scenario? Or should I attempt to send the first search to a lookup table then try to input that data into the 2nd search?&lt;/P&gt;

&lt;P&gt;Any help would be appreciated!&lt;BR /&gt;
Thanks,&lt;BR /&gt;
T&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 19:05:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-From-Two-Indexes-Applying-A-Name-Referenced-By-Id-On-Both/m-p/438590#M124832</guid>
      <dc:creator>tdotcspot</dc:creator>
      <dc:date>2018-12-17T19:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Search From Two Indexes. Applying A Name Referenced By Id On Both Searches.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-From-Two-Indexes-Applying-A-Name-Referenced-By-Id-On-Both/m-p/438591#M124833</link>
      <description>&lt;P&gt;Just to add I did accomplish this using a "join", but I am unsure if this is the best way to go based on performance.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="cloudwatch" metric_name=CPUUtilization
| rex field=metric_dimensions "^(?&amp;lt;instanceId&amp;gt;(\bInstanceId=.*\b))"
| eval instanceId = trim(replace(instanceId, "InstanceId=\[", ""))
| join instanceId
[ search index="description" | spath output="instanceId" id | search id="i-*" | spath output="instanceName" "tags.Name" | search "tags.Name"="*" | dedup instanceId]
| timechart eval(round(avg(Average),2)) by instanceName where max in top10
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Dec 2018 19:36:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-From-Two-Indexes-Applying-A-Name-Referenced-By-Id-On-Both/m-p/438591#M124833</guid>
      <dc:creator>tdotcspot</dc:creator>
      <dc:date>2018-12-17T19:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Search From Two Indexes. Applying A Name Referenced By Id On Both Searches.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-From-Two-Indexes-Applying-A-Name-Referenced-By-Id-On-Both/m-p/438592#M124834</link>
      <description>&lt;P&gt;Can you show some some sample data for both the searches, also show the &lt;CODE&gt;append&lt;/CODE&gt; search. if possible, avoid &lt;CODE&gt;join&lt;/CODE&gt; as best as you can &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 22:09:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-From-Two-Indexes-Applying-A-Name-Referenced-By-Id-On-Both/m-p/438592#M124834</guid>
      <dc:creator>macadminrohit</dc:creator>
      <dc:date>2018-12-17T22:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: Search From Two Indexes. Applying A Name Referenced By Id On Both Searches.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-From-Two-Indexes-Applying-A-Name-Referenced-By-Id-On-Both/m-p/438593#M124835</link>
      <description>&lt;P&gt;I just produced a dummy search which could help you. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval DATA="1100,AWS101" | eval _time=now()
| makemv DATA delim="," 
| eval InstanceID=mvindex(DATA,0) 
| eval InstanceName=mvindex(DATA,1) 
| table InstanceName InstanceID _time
| append 
    [| makeresults 
    | eval _time=now() 
    | eval DATA1="50,1100" 
    | makemv DATA1 delim="," 
    | eval cwInstanceId=mvindex(DATA1,1) 
    | eval CPU_Util=mvindex(DATA1,0) 
    | table cwInstanceId CPU_Util _time | rename cwInstanceId as InstanceID] 
| table InstanceName InstanceID CPU_Util _time | eventstats values(InstanceName) as InstanceName by InstanceID | where NOT isnull(CPU_Util)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Dec 2018 22:21:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-From-Two-Indexes-Applying-A-Name-Referenced-By-Id-On-Both/m-p/438593#M124835</guid>
      <dc:creator>macadminrohit</dc:creator>
      <dc:date>2018-12-17T22:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: Search From Two Indexes. Applying A Name Referenced By Id On Both Searches.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-From-Two-Indexes-Applying-A-Name-Referenced-By-Id-On-Both/m-p/438594#M124836</link>
      <description>&lt;P&gt;index="cloudwatch" metric_name=CPUUtilization index="description" | spath output="dInstanceId" id | search id="i-*" | spath output="dInstanceName" "tags.Name"&lt;/P&gt;

&lt;P&gt;| rex field=metric_dimensions "^(?(\bInstanceId=.*\b))"&lt;BR /&gt;
 | eval cwInstanceId = trim(replace(cwInstanceId, "InstanceId=[", ""))&lt;/P&gt;

&lt;P&gt;|dedup dInstanceName &lt;/P&gt;

&lt;P&gt;| stats count by  dInstanceId, dInstanceName, _time &lt;BR /&gt;
|fields  dInstanceName, _time &lt;/P&gt;</description>
      <pubDate>Fri, 21 Dec 2018 20:26:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-From-Two-Indexes-Applying-A-Name-Referenced-By-Id-On-Both/m-p/438594#M124836</guid>
      <dc:creator>valiquet</dc:creator>
      <dc:date>2018-12-21T20:26:59Z</dc:date>
    </item>
  </channel>
</rss>

