<?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 can I put fields from joined searches in a summary index? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-put-fields-from-joined-searches-in-a-summary-index/m-p/373634#M109874</link>
    <description>&lt;P&gt;For what it's worth, I've also tried something like this to no avail:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=app_caspectrum sourcetype="spectrum:event" source="prod_spectrum_reporting" 
| eval LastStatus="Triggered"
| eval activity_time="NA"
| eval activity_user="NA"
| eval activity_s="NA"
| join event_key [ search index=app_caspectrum sourcetype="spectrum:alarm" source="prod_spectrum_reporting"    
 | rename orig_event_key as event_key    
 | join type=left alarm_key [ 
  search index=app_caspectrum sourcetype="spectrum:alarm:activity" source="prod_spectrum_reporting"     
  | rename time as activity_time     
  | rename user as activity_user     
  | transaction alarm_key      
  | eval LastStatus=mvindex(activity_s, -1)     
  | table alarm_key LastStatus activity_time activity_s  
  ] 
] 
| eval _raw="Alarm Time=" . time . " Model=" . model_name . " Condition=" . condition_name . " ModelClass=" . mclass_name . " ModelType=" . mtype_name . " DeviceType=" . device_type . " Activity=" . activity_s . " ActivityTime=" . activity_time . " Event=\"" . replace(event_msg, "\"", "'") . "\""
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 29 Jun 2017 13:34:24 GMT</pubDate>
    <dc:creator>paimonsoror</dc:creator>
    <dc:date>2017-06-29T13:34:24Z</dc:date>
    <item>
      <title>How can I put fields from joined searches in a summary index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-put-fields-from-joined-searches-in-a-summary-index/m-p/373633#M109873</link>
      <description>&lt;P&gt;Hi folks;&lt;/P&gt;

&lt;P&gt;I have the following query that i use as a base search to feed a dashboard:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=app_caspectrum sourcetype="spectrum:event" source="prod_spectrum_reporting" | join event_key [ search index=app_caspectrum sourcetype="spectrum:alarm" source="prod_spectrum_reporting"    | rename orig_event_key as event_key    | join type=left alarm_key [ search index=app_caspectrum sourcetype="spectrum:alarm:activity" source="prod_spectrum_reporting"     | rename time as activity_time     | rename user as activity_user     | transaction alarm_key      | eval LastStatus=mvindex(activity_s, -1)     | table alarm_key LastStatus   ] ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There are several fields that are part of each event that is produced as they are the fields from each subsearch for the related event_key's and whatnot.  The problem however, is when I go and 'collect' this data and put it in my summary index, it only seems to be 'collecting' the fields from the first search.  The fields that were added as a result of the joins are not being added.&lt;/P&gt;

&lt;P&gt;I have even tried something silly like this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=app_caspectrum sourcetype="spectrum:event" source="prod_spectrum_reporting" | join event_key [ search index=app_caspectrum sourcetype="spectrum:alarm" source="prod_spectrum_reporting"    | rename orig_event_key as event_key    | join type=left alarm_key [ search index=app_caspectrum sourcetype="spectrum:alarm:activity" source="prod_spectrum_reporting"     | rename time as activity_time     | rename user as activity_user     | transaction alarm_key      | eval LastStatus=mvindex(activity_s, -1)     | table alarm_key LastStatus   ] ]
| fields condition_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;condition_name is a field that is added to each event from one of the join's.  Once this is added to a summary index, condition_name isn't there.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:40:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-put-fields-from-joined-searches-in-a-summary-index/m-p/373633#M109873</guid>
      <dc:creator>paimonsoror</dc:creator>
      <dc:date>2020-09-29T14:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: How can I put fields from joined searches in a summary index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-put-fields-from-joined-searches-in-a-summary-index/m-p/373634#M109874</link>
      <description>&lt;P&gt;For what it's worth, I've also tried something like this to no avail:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=app_caspectrum sourcetype="spectrum:event" source="prod_spectrum_reporting" 
| eval LastStatus="Triggered"
| eval activity_time="NA"
| eval activity_user="NA"
| eval activity_s="NA"
| join event_key [ search index=app_caspectrum sourcetype="spectrum:alarm" source="prod_spectrum_reporting"    
 | rename orig_event_key as event_key    
 | join type=left alarm_key [ 
  search index=app_caspectrum sourcetype="spectrum:alarm:activity" source="prod_spectrum_reporting"     
  | rename time as activity_time     
  | rename user as activity_user     
  | transaction alarm_key      
  | eval LastStatus=mvindex(activity_s, -1)     
  | table alarm_key LastStatus activity_time activity_s  
  ] 
] 
| eval _raw="Alarm Time=" . time . " Model=" . model_name . " Condition=" . condition_name . " ModelClass=" . mclass_name . " ModelType=" . mtype_name . " DeviceType=" . device_type . " Activity=" . activity_s . " ActivityTime=" . activity_time . " Event=\"" . replace(event_msg, "\"", "'") . "\""
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Jun 2017 13:34:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-put-fields-from-joined-searches-in-a-summary-index/m-p/373634#M109874</guid>
      <dc:creator>paimonsoror</dc:creator>
      <dc:date>2017-06-29T13:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: How can I put fields from joined searches in a summary index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-put-fields-from-joined-searches-in-a-summary-index/m-p/373635#M109875</link>
      <description>&lt;P&gt;I may have figured this out.  Here is what I ended up doing:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=app_caspectrum sourcetype="spectrum:event" source="prod_spectrum_reporting" 
| eval LastStatus="Triggered"
| eval activity_time="NA"
| eval activity_user="NA"
| eval activity_s="NA"
| join event_key [ search index=app_caspectrum sourcetype="spectrum:alarm" source="prod_spectrum_reporting"    
 | rename orig_event_key as event_key    
 | join type=left alarm_key [ 
  search index=app_caspectrum sourcetype="spectrum:alarm:activity" source="prod_spectrum_reporting"     
  | rename time as activity_time     
  | rename user as activity_user     
  | transaction alarm_key      
  | eval LastStatus=mvindex(activity_s, -1)     
  | table alarm_key LastStatus activity_time activity_s  
  ] 
] 
| eval _raw="Alarm Time=" . time . " Model=" . model_name . " Condition=" . condition_name . " ModelClass=" . mclass_name . " ModelType=" . mtype_name . " DeviceType=" . device_type . " Activity=" . activity_s . " ActivityTime=" . activity_time . " Event=\"" . replace(event_msg, "\"", "'") . "\"" 
| collect index="summary_executive" sourcetype="executive_stash"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and then creating a transforms.conf on my searchheads:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[executive_stash_delim]
DELIMS = "="
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and a props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[executive_stash]
REPORT-activity = executive_stash_delim
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Jun 2017 13:58:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-put-fields-from-joined-searches-in-a-summary-index/m-p/373635#M109875</guid>
      <dc:creator>paimonsoror</dc:creator>
      <dc:date>2017-06-29T13:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can I put fields from joined searches in a summary index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-put-fields-from-joined-searches-in-a-summary-index/m-p/373636#M109876</link>
      <description>&lt;P&gt;It looks like you've figured out how to use the collect command manually, which is great. &lt;BR /&gt;
I thought I'd give you a different answer trying to also rewrite the search to avoid the join command. &lt;BR /&gt;
This search looks very much like a case that can be rewritten to not use join at all. &lt;/P&gt;

&lt;P&gt;However I can't tell you exactly how to do it yet,  without knowing more of the relationship between alarm_key and event_key. &lt;/P&gt;

&lt;P&gt;Can you provide some specific example events to illustrate that relationship?   &lt;/P&gt;

&lt;P&gt;Until then,   I can get you as far as this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=app_caspectrum source="prod_spectrum_reporting" ( sourcetype="spectrum:event" OR sourcetype="spectrum:alarm" OR sourcetype="spectrum:alarm:activity") 
| eval event_key=if(sourcetype="spectrum:alarm",orig_event_key,null())
| eval activity_time=if(sourcetype="spectrum:alarm:activity",time)
| eval activity_user=if(sourcetype="spectrum:alarm:activity",user)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From there,  &lt;EM&gt;possibly&lt;/EM&gt; it's as simple as just tacking a &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats last(activity_s) as LastStatus values(condition_name) as Condition values(mclass_name) as ModelClass values(mtype_name) as ModelType values(device_type) as DeviceType values(activity_time) as ActivityTime by alarm_key event_key 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but I suspect there's a nuance or two in the relationship between event_key and alarm_key that will require a little streamstats/eventstats/eval magic trick just before the stats. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:37:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-put-fields-from-joined-searches-in-a-summary-index/m-p/373636#M109876</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2020-09-29T14:37:01Z</dc:date>
    </item>
  </channel>
</rss>

