<?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: join two queries depends on common fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455661#M128835</link>
    <description>&lt;P&gt;Awesome, first make sure your base search gives results. I see you're missing a couple of parentheses, should be like this  : &lt;BR /&gt;
      ((index=ssys_&lt;EM&gt;_pj OR index=other) NOT source=*Bio_Mimics&lt;/EM&gt; &lt;BR /&gt;
         (Head Optimization Wizard ((started) OR (ended) OR (was selected) OR (num of missing) OR (Save voltage) OR (Support voltage) OR (Model voltage) OR (Target layer Net))) OR&lt;BR /&gt;
         (("Serial Number") OR ("Head Type") OR ("Maintenance counter")))&lt;BR /&gt;
         OR&lt;BR /&gt;
        ( (index=ssys_*_pj OR index=other) source=*HQ.cfg OR source=*HM.cfg OR source=*HS.cfg AND (RequestedHeadVoltagesSupport OR RequestedHeadVoltagesModel ))&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 00:34:23 GMT</pubDate>
    <dc:creator>DavidHourani</dc:creator>
    <dc:date>2020-09-30T00:34:23Z</dc:date>
    <item>
      <title>join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455658#M128832</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt;
i have this query :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=ssys_*_pj OR index=other) NOT source=*Bio_Mimics* 
(Head Optimization Wizard ((started) OR (ended) OR (was selected) OR (num of missing) OR (Save voltage) OR (Support voltage) OR (Model voltage) OR (Target layer Net))) OR
(("Serial Number") OR ("Head Type") OR ("Maintenance counter"))
|`SerialNumber`
| search SerialNumber=*
|`Region`
| search Region=*
|`PrinterType`
| rex "Serial Number = (?&amp;lt;HeadSerialNumber&amp;gt;\S+)"
| rex field=HeadSerialNumber mode=sed "s/,//"
| rex "Head Type = (?&amp;lt;HeadType&amp;gt;[\w\ ]+)"
| rex "Head Optimization Wizard: (?&amp;lt;WizardMode&amp;gt;\S+) was selected"
| rex "Nozzles for head Head (?&amp;lt;head&amp;gt;\d+) is (?&amp;lt;missing_nozzles&amp;gt;\d+)"
| rex "physical Head Index = (?&amp;lt;head&amp;gt;\d+)"
| rex "Save voltage (?&amp;lt;Calibrated_voltage&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
| rex "Support voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
| rex "Model voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
| rex "Head Optimization Wizard: (?&amp;lt;wizard_ended&amp;gt;ended)"
| rex "Head Optimization Wizard: (?&amp;lt;wizard_started&amp;gt;started)"
| rex "Target layer Net\s+\=\s+(?&amp;lt;Layer&amp;gt;[\d\.]+)"
| eval startedTime=if(isnotnull(wizard_started),_time,null())
| eval startedSource=if(isnotnull(wizard_started),source,null())
| eval endedTime=if(isnotnull(wizard_ended),_time,null())
| eval endedSource=if(isnotnull(wizard_ended),source,null())
| rex "Maintenance counter \"H(?&amp;lt;head&amp;gt;\d+)\" Value is: (?&amp;lt;head_lifetime&amp;gt;\d+)"
| eventstats max(startedTime) as startedTime max(endedTime) as endedTime by SerialNumber
| where isnotnull(HeadSerialNumber) OR isnotnull(HeadType) OR (_time&amp;gt;=startedTime AND _time&amp;lt;=endedTime)
| sort 0 _time 
| streamstats last(Layer) as Layer  last(WizardMode) as WizardMode last(startedTime) as startedTime last(startedSource) as startedSource last(endedTime) as endedTime last(endedSource) as endedSource by SerialNumber
| stats last(endedSource) as endedSource last(startedSource) as startedSource max(startedTime) as startedTime max(endedTime) as endedTime last(*) as * by SerialNumber head
| search HeadSerialNumber=* HeadType=*
| lookup internal_Printers SN as SerialNumber OUTPUT  Type
| eval Internal=if(isnotnull(Type),"T","F")
| table startedTime endedTime Type Region Internal SerialNumber PrinterType head HeadSerialNumber HeadType missing_nozzles HeadVoltage HeadVoltageDate  Voltage_before_optimization Calibrated_voltage head_lifetime Layer WizardMode startedSource endedSource
| rename Calibrated_voltage as Calibrated_voltage_after_optimization

| join type=left Region SerialNumber MachineMode head 
    [search (index=ssys_*_pj OR index=other) source=*HQ.cfg OR source=*HM.cfg OR source=*HS.cfg AND (RequestedHeadVoltagesSupport OR RequestedHeadVoltagesModel )
| `SerialNumber`
|`Region`
| rex field=source "PerMachine_(?&amp;lt;WizardMode&amp;gt;[^\.]+)" 
| eval WizardMode=if(WizardMode=="HM","HS/HM",WizardMode) 
| rex "RequestedHeadVoltagesSupport=(?&amp;lt;head0&amp;gt;[^,]+),(?&amp;lt;head1&amp;gt;[^,]+)," 
| rex "RequestedHeadVoltagesModel=[^,]+,[^,]+,(?&amp;lt;head2&amp;gt;[^,]+),(?&amp;lt;head3&amp;gt;[^,]+),(?&amp;lt;head4&amp;gt;[^,]+),(?&amp;lt;head5&amp;gt;[^,]+),(?&amp;lt;head6&amp;gt;[^,]+),(?&amp;lt;head7&amp;gt;[^,]+)"
| stats latest(*) as * max(_time) as headVoltageDate by SerialNumber Region
| table HeadVoltageDate Region SerialNumber WizardMode head*
| eval id=Region+"@"+SerialNumber+"@"+WizardMode+"@"+headVoltageDate
| table id head* 
| rename head* as *
| untable id head HeadVoltage
| eval id=split(id,"@")
| eval Region=mvindex(id,0)
| eval SerialNumber=mvindex(id,1)
| eval WizardMode=mvindex(id,2)
| eval HeadVoltageDate=mvindex(id,3)
| table  Region SerialNumber WizardMode head HeadVoltage HeadVoltageDate]
| convert ctime(endedTime) ctime(startedTime) ctime(HeadVoltageDate) timeformat="%F %T"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i have few issues with that:&lt;BR /&gt;
1. there are some cases that i will have SerialNumber that has data from the second search and not from the first one, in that cases the query does not return any result.&lt;BR /&gt;
2. in the dashboard above this query i have text boxes the their default value is *. I have cases where some SerialNumber does not have value in HeadSerialNumber or HeadType. in that cases the query returns no results. is there a way to give different default value ?&lt;BR /&gt;
3. i have cases that same SerialNumber appears in more than one PrinterType. in such cases the query returns only one PrinterType and i can see that both PrinterTypes are joined together&lt;BR /&gt;
4. Join is expensive command. maybe there is a way to replace it with some other command ?&lt;BR /&gt;
i guess that the join part is the main reason of all the issues i mentioned &lt;/P&gt;

&lt;P&gt;thank you very much for your help&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 07:22:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455658#M128832</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2019-05-15T07:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455659#M128833</link>
      <description>&lt;P&gt;Hi again @sarit_s,&lt;/P&gt;

&lt;P&gt;Avoid using join whenever possible. In your case you want to first call all the data and then combine it using a stats command, that would actually solve all the problems you mentioned here. &lt;/P&gt;

&lt;P&gt;Your search should then look something like this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( (index=ssys_*_pj OR index=other) NOT source=*Bio_Mimics* 
 (Head Optimization Wizard ((started) OR (ended) OR (was selected) OR (num of missing) OR (Save voltage) OR (Support voltage) OR (Model voltage) OR (Target layer Net))) OR
 (("Serial Number") OR ("Head Type") OR ("Maintenance counter")) )
OR
((index=ssys_*_pj OR index=other) source=*HQ.cfg OR source=*HM.cfg OR source=*HS.cfg AND (RequestedHeadVoltagesSupport OR RequestedHeadVoltagesModel ))
|....all you rex and evals go here....
|stats values(valuesyouneed) as valuesyouneed ... by Region SerialNumber MachineMod
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;First you grab all the events from both parts you want to join, then you make your evals and rex to get ur fields ready, and finally you run a stats by the joining fields and get the values of the fields you need in the table.&lt;/P&gt;

&lt;P&gt;Let me know if you got the point.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 09:26:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455659#M128833</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-15T09:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455660#M128834</link>
      <description>&lt;P&gt;Hi @DavidHourani &lt;BR /&gt;
thanks for all your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;this is what i did and it returns no results.. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (index=ssys_*_pj OR index=other) NOT source=*Bio_Mimics* 
    (Head Optimization Wizard ((started) OR (ended) OR (was selected) OR (num of missing) OR (Save voltage) OR (Support voltage) OR (Model voltage) OR (Target layer Net))) OR
    (("Serial Number") OR ("Head Type") OR ("Maintenance counter"))
    OR
    (index=ssys_*_pj OR index=other) source=*HQ.cfg OR source=*HM.cfg OR source=*HS.cfg AND (RequestedHeadVoltagesSupport OR RequestedHeadVoltagesModel )
    |`SerialNumber`
    | search SerialNumber=IL01-R9JVNZD
    |`Region`
    | search Region=*
    |`PrinterType`
    | rex "Serial Number = (?&amp;lt;HeadSerialNumber&amp;gt;\S+)"
    | rex field=HeadSerialNumber mode=sed "s/,//"
    | rex "Head Type = (?&amp;lt;HeadType&amp;gt;[\w\ ]+)"
    | rex "Head Optimization Wizard: (?&amp;lt;WizardMode&amp;gt;\S+) was selected"
    | rex "Nozzles for head Head (?&amp;lt;head&amp;gt;\d+) is (?&amp;lt;missing_nozzles&amp;gt;\d+)"
    | rex "physical Head Index = (?&amp;lt;head&amp;gt;\d+)"
    | rex "Save voltage (?&amp;lt;Calibrated_voltage&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
    | rex "Support voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
    | rex "Model voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
    | rex "Head Optimization Wizard: (?&amp;lt;wizard_ended&amp;gt;ended)"
    | rex "Head Optimization Wizard: (?&amp;lt;wizard_started&amp;gt;started)"
    | rex "Target layer Net\s+\=\s+(?&amp;lt;Layer&amp;gt;[\d\.]+)"
    | eval startedTime=if(isnotnull(wizard_started),_time,null())
    | eval startedSource=if(isnotnull(wizard_started),source,null())
    | eval endedTime=if(isnotnull(wizard_ended),_time,null())
    | eval endedSource=if(isnotnull(wizard_ended),source,null())
    | rex "Maintenance counter \"H(?&amp;lt;head&amp;gt;\d+)\" Value is: (?&amp;lt;head_lifetime&amp;gt;\d+)"
    | eventstats max(startedTime) as startedTime max(endedTime) as endedTime by SerialNumber
    | where isnotnull(HeadSerialNumber) OR isnotnull(HeadType) OR (_time&amp;gt;=startedTime AND _time&amp;lt;=endedTime)
    | sort 0 _time 
    | streamstats last(Layer) as Layer  last(WizardMode) as WizardMode last(startedTime) as startedTime last(startedSource) as startedSource last(endedTime) as endedTime last(endedSource) as endedSource by SerialNumber
    | stats last(endedSource) as endedSource last(startedSource) as startedSource max(startedTime) as startedTime max(endedTime) as endedTime last(*) as * by SerialNumber head
    | search HeadSerialNumber=* HeadType=*
    | lookup internal_Printers SN as SerialNumber OUTPUT  Type
    | eval Internal=if(isnotnull(Type),"T","F")
    | table startedTime endedTime Type Region Internal SerialNumber PrinterType head HeadSerialNumber HeadType missing_nozzles HeadVoltage HeadVoltageDate  Voltage_before_optimization Calibrated_voltage head_lifetime Layer WizardMode startedSource endedSource
    | rename Calibrated_voltage as Calibrated_voltage_after_optimization

    | rex field=source "PerMachine_(?&amp;lt;WizardMode&amp;gt;[^\.]+)" 
    | eval WizardMode=if(WizardMode=="HM","HS/HM",WizardMode) 
    | rex "RequestedHeadVoltagesSupport=(?&amp;lt;head0&amp;gt;[^,]+),(?&amp;lt;head1&amp;gt;[^,]+)," 
    | rex "RequestedHeadVoltagesModel=[^,]+,[^,]+,(?&amp;lt;head2&amp;gt;[^,]+),(?&amp;lt;head3&amp;gt;[^,]+),(?&amp;lt;head4&amp;gt;[^,]+),(?&amp;lt;head5&amp;gt;[^,]+),(?&amp;lt;head6&amp;gt;[^,]+),(?&amp;lt;head7&amp;gt;[^,]+)"
    | stats latest(*) as * max(_time) as headVoltageDate by SerialNumber Region
    | table HeadVoltageDate Region SerialNumber WizardMode head*
    | eval id=Region+"@"+SerialNumber+"@"+WizardMode+"@"+headVoltageDate
    | table id head* 
    | rename head* as *
    | untable id head HeadVoltage
    | eval id=split(id,"@")
    | eval Region=mvindex(id,0)
    | eval SerialNumber=mvindex(id,1)
    | eval WizardMode=mvindex(id,2)
    | eval HeadVoltageDate=mvindex(id,3)
    | table  Region SerialNumber WizardMode head HeadVoltage HeadVoltageDate
    | convert ctime(endedTime) ctime(startedTime) ctime(HeadVoltageDate) timeformat="%F %T"
    |stats values(*) as * by Region SerialNumber MachineMod
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 May 2019 10:34:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455660#M128834</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2019-05-15T10:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455661#M128835</link>
      <description>&lt;P&gt;Awesome, first make sure your base search gives results. I see you're missing a couple of parentheses, should be like this  : &lt;BR /&gt;
      ((index=ssys_&lt;EM&gt;_pj OR index=other) NOT source=*Bio_Mimics&lt;/EM&gt; &lt;BR /&gt;
         (Head Optimization Wizard ((started) OR (ended) OR (was selected) OR (num of missing) OR (Save voltage) OR (Support voltage) OR (Model voltage) OR (Target layer Net))) OR&lt;BR /&gt;
         (("Serial Number") OR ("Head Type") OR ("Maintenance counter")))&lt;BR /&gt;
         OR&lt;BR /&gt;
        ( (index=ssys_*_pj OR index=other) source=*HQ.cfg OR source=*HM.cfg OR source=*HS.cfg AND (RequestedHeadVoltagesSupport OR RequestedHeadVoltagesModel ))&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:34:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455661#M128835</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2020-09-30T00:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455662#M128836</link>
      <description>&lt;P&gt;the base search gives results.&lt;BR /&gt;
i think the problem starts after the first table&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 10:42:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455662#M128836</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2019-05-15T10:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455663#M128837</link>
      <description>&lt;P&gt;this one ?      &lt;CODE&gt;| table startedTime endedTime Type Region Internal SerialNumber PrinterType head HeadSerialNumber HeadType missing_nozzles HeadVoltage HeadVoltageDate  Voltage_before_optimization Calibrated_voltage head_lifetime Layer WizardMode startedSource endedSource&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Skip using tables are you data is already in tabular format.&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 10:44:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455663#M128837</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-15T10:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455664#M128838</link>
      <description>&lt;P&gt;removed all tables, still nothing.. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  ((index=ssys_pj OR index=other) NOT source=Bio_Mimics 
    (Head Optimization Wizard ((started) OR (ended) OR (was selected) OR (num of missing) OR (Save voltage) OR (Support voltage) OR (Model voltage) OR (Target layer Net))) OR
    (("Serial Number") OR ("Head Type") OR ("Maintenance counter")))
    OR
    ( (index=ssys_pj OR index=other) source=*HQ.cfg OR source=*HM.cfg OR source=*HS.cfg AND (RequestedHeadVoltagesSupport OR RequestedHeadVoltagesModel ))
    |`SerialNumber`
    | search SerialNumber=*
    |`Region`
    | search Region=*
    |`PrinterType`
    | rex "Serial Number = (?&amp;lt;HeadSerialNumber&amp;gt;\S+)"
    | rex field=HeadSerialNumber mode=sed "s/,//"
    | rex "Head Type = (?&amp;lt;HeadType&amp;gt;[\w\ ]+)"
    | rex "Head Optimization Wizard: (?&amp;lt;WizardMode&amp;gt;\S+) was selected"
    | rex "Nozzles for head Head (?&amp;lt;head&amp;gt;\d+) is (?&amp;lt;missing_nozzles&amp;gt;\d+)"
    | rex "physical Head Index = (?&amp;lt;head&amp;gt;\d+)"
    | rex "Save voltage (?&amp;lt;Calibrated_voltage&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
    | rex "Support voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
    | rex "Model voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
    | rex "Head Optimization Wizard: (?&amp;lt;wizard_ended&amp;gt;ended)"
    | rex "Head Optimization Wizard: (?&amp;lt;wizard_started&amp;gt;started)"
    | rex "Target layer Net\s+\=\s+(?&amp;lt;Layer&amp;gt;[\d\.]+)"
    | eval startedTime=if(isnotnull(wizard_started),_time,null())
    | eval startedSource=if(isnotnull(wizard_started),source,null())
    | eval endedTime=if(isnotnull(wizard_ended),_time,null())
    | eval endedSource=if(isnotnull(wizard_ended),source,null())
    | rex "Maintenance counter \"H(?&amp;lt;head&amp;gt;\d+)\" Value is: (?&amp;lt;head_lifetime&amp;gt;\d+)"
    | eventstats max(startedTime) as startedTime max(endedTime) as endedTime by SerialNumber
    | where isnotnull(HeadSerialNumber) OR isnotnull(HeadType) OR (_time&amp;gt;=startedTime AND _time&amp;lt;=endedTime)
    | sort 0 _time 
    | streamstats last(Layer) as Layer  last(WizardMode) as WizardMode last(startedTime) as startedTime last(startedSource) as startedSource last(endedTime) as endedTime last(endedSource) as endedSource by SerialNumber
    | stats last(endedSource) as endedSource last(startedSource) as startedSource max(startedTime) as startedTime max(endedTime) as endedTime last(*) as * by SerialNumber head
    | search HeadSerialNumber=* HeadType=*
    | lookup internal_Printers SN as SerialNumber OUTPUT  Type
    | eval Internal=if(isnotnull(Type),"T","F")
    | rename Calibrated_voltage as Calibrated_voltage_after_optimization
    | rex field=source "PerMachine_(?&amp;lt;WizardMode&amp;gt;[^\.]+)" 
    | eval WizardMode=if(WizardMode=="HM","HS/HM",WizardMode) 
    | rex "RequestedHeadVoltagesSupport=(?&amp;lt;head0&amp;gt;[^,]+),(?&amp;lt;head1&amp;gt;[^,]+)," 
    | rex "RequestedHeadVoltagesModel=[^,]+,[^,]+,(?&amp;lt;head2&amp;gt;[^,]+),(?&amp;lt;head3&amp;gt;[^,]+),(?&amp;lt;head4&amp;gt;[^,]+),(?&amp;lt;head5&amp;gt;[^,]+),(?&amp;lt;head6&amp;gt;[^,]+),(?&amp;lt;head7&amp;gt;[^,]+)"
    | stats latest(*) as * max(_time) as headVoltageDate by SerialNumber Region
    | eval id=Region+"@"+SerialNumber+"@"+WizardMode+"@"+headVoltageDate
    | table id head* 
    | rename head* as *
    | untable id head HeadVoltage
    | eval id=split(id,"@")
    | eval Region=mvindex(id,0)
    | eval SerialNumber=mvindex(id,1)
    | eval WizardMode=mvindex(id,2)
    | eval HeadVoltageDate=mvindex(id,3)
    |stats values(*) as * by Region SerialNumber  MachineMode head
    | convert ctime(endedTime) ctime(startedTime) ctime(HeadVoltageDate) timeformat="%F %T"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 May 2019 10:46:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455664#M128838</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2019-05-15T10:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455665#M128839</link>
      <description>&lt;P&gt;can you add your lines one by one to identify where you're losing the results ?&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 10:47:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455665#M128839</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-15T10:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455666#M128840</link>
      <description>&lt;P&gt;until here i have results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;((index=ssys_pj OR index=other) NOT source=Bio_Mimics 
(Head Optimization Wizard ((started) OR (ended) OR (was selected) OR (num of missing) OR (Save voltage) OR (Support voltage) OR (Model voltage) OR (Target layer Net))) OR
(("Serial Number") OR ("Head Type") OR ("Maintenance counter")))
OR
( (index=ssys_pj OR index=other) source=*HQ.cfg OR source=*HM.cfg OR source=*HS.cfg AND (RequestedHeadVoltagesSupport OR RequestedHeadVoltagesModel ))
|`SerialNumber`
| search SerialNumber=*
|`Region`
| search Region=*
|`PrinterType`
| rex "Serial Number = (?&amp;lt;HeadSerialNumber&amp;gt;\S+)"
| rex field=HeadSerialNumber mode=sed "s/,//"
| rex "Head Type = (?&amp;lt;HeadType&amp;gt;[\w\ ]+)"
| rex "Head Optimization Wizard: (?&amp;lt;WizardMode&amp;gt;\S+) was selected"
| rex "Nozzles for head Head (?&amp;lt;head&amp;gt;\d+) is (?&amp;lt;missing_nozzles&amp;gt;\d+)"
| rex "physical Head Index = (?&amp;lt;head&amp;gt;\d+)"
| rex "Save voltage (?&amp;lt;Calibrated_voltage&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
| rex "Support voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
| rex "Model voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
| rex "Head Optimization Wizard: (?&amp;lt;wizard_ended&amp;gt;ended)"
| rex "Head Optimization Wizard: (?&amp;lt;wizard_started&amp;gt;started)"
| rex "Target layer Net\s+\=\s+(?&amp;lt;Layer&amp;gt;[\d\.]+)"
| eval startedTime=if(isnotnull(wizard_started),_time,null())
| eval startedSource=if(isnotnull(wizard_started),source,null())
| eval endedTime=if(isnotnull(wizard_ended),_time,null())
| eval endedSource=if(isnotnull(wizard_ended),source,null())
| rex "Maintenance counter \"H(?&amp;lt;head&amp;gt;\d+)\" Value is: (?&amp;lt;head_lifetime&amp;gt;\d+)"
| eventstats max(startedTime) as startedTime max(endedTime) as endedTime by SerialNumber
| where isnotnull(HeadSerialNumber) OR isnotnull(HeadType) OR (_time&amp;gt;=startedTime AND _time&amp;lt;=endedTime)
| sort 0 _time 
| streamstats last(Layer) as Layer  last(WizardMode) as WizardMode last(startedTime) as startedTime last(startedSource) as startedSource last(endedTime) as endedTime last(endedSource) as endedSource by SerialNumber
| stats last(endedSource) as endedSource last(startedSource) as startedSource max(startedTime) as startedTime max(endedTime) as endedTime last(*) as * by SerialNumber head
| search HeadSerialNumber=* HeadType=*
| lookup internal_Printers SN as SerialNumber OUTPUT  Type
| eval Internal=if(isnotnull(Type),"T","F")
| table startedTime endedTime Type Region Internal SerialNumber PrinterType head HeadSerialNumber HeadType missing_nozzles HeadVoltage HeadVoltageDate  Voltage_before_optimization Calibrated_voltage head_lifetime Layer WizardMode startedSource endedSource
| rename Calibrated_voltage as Calibrated_voltage_after_optimization

| rex field=source "PerMachine_(?&amp;lt;WizardMode&amp;gt;[^\.]+)" 
| eval WizardMode=if(WizardMode=="HM","HS/HM",WizardMode) 
| rex "RequestedHeadVoltagesSupport=(?&amp;lt;head0&amp;gt;[^,]+),(?&amp;lt;head1&amp;gt;[^,]+)," 
| rex "RequestedHeadVoltagesModel=[^,]+,[^,]+,(?&amp;lt;head2&amp;gt;[^,]+),(?&amp;lt;head3&amp;gt;[^,]+),(?&amp;lt;head4&amp;gt;[^,]+),(?&amp;lt;head5&amp;gt;[^,]+),(?&amp;lt;head6&amp;gt;[^,]+),(?&amp;lt;head7&amp;gt;[^,]+)"
| stats latest(*) as * max(_time) as headVoltageDate by SerialNumber Region
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;when adding this part i lose data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table HeadVoltageDate Region SerialNumber WizardMode head*
| eval id=Region+"@"+SerialNumber+"@"+WizardMode+"@"+headVoltageDate
| table id head* 
| rename head* as *
| untable id head HeadVoltage
| eval id=split(id,"@")
| eval Region=mvindex(id,0)
| eval SerialNumber=mvindex(id,1)
| eval WizardMode=mvindex(id,2)
| eval HeadVoltageDate=mvindex(id,3)
| table  Region SerialNumber WizardMode head HeadVoltage HeadVoltageDate
|stats values(*) as * by Region SerialNumber  MachineMode head
| convert ctime(endedTime) ctime(startedTime) ctime(HeadVoltageDate) timeformat="%F %T"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 May 2019 10:49:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455666#M128840</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2019-05-15T10:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455667#M128841</link>
      <description>&lt;P&gt;Why are you using the "latest(&lt;EM&gt;)" in the stats command and no "values(&lt;/EM&gt;)" to maintain all ur values ?&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 10:53:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455667#M128841</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-15T10:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455668#M128842</link>
      <description>&lt;P&gt;since i need to take the last time it appears in the logs&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 10:58:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455668#M128842</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2019-05-15T10:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455669#M128843</link>
      <description>&lt;P&gt;so it should be :  &lt;CODE&gt;| stats values(*) as * latest(_time) as headVoltageDate by SerialNumber Region&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 11:00:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455669#M128843</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-15T11:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455670#M128844</link>
      <description>&lt;P&gt;this is not the only date field i should take care of. i need to take into account few fields&lt;BR /&gt;
i need to correlate between the "head" in all the events and combine them so for each head i will have all the relevant data &lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 11:08:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455670#M128844</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2019-05-15T11:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455671#M128845</link>
      <description>&lt;P&gt;ummm in that case stick to this : &lt;CODE&gt;| stats latest(*) as *  by SerialNumber Region&lt;/CODE&gt; you don't need the &lt;CODE&gt;max(_time)&lt;/CODE&gt; as it's already there in &lt;CODE&gt;latest(*) as *&lt;/CODE&gt;.  check if that give you any results. Then you can rename _time as headVoltageDate&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 11:15:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455671#M128845</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-15T11:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455672#M128846</link>
      <description>&lt;P&gt;still no results &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 11:20:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455672#M128846</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2019-05-15T11:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455673#M128847</link>
      <description>&lt;P&gt;no results after the stats yeah ? or when you add the other chunk of code ?&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 11:24:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455673#M128847</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-15T11:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455674#M128848</link>
      <description>&lt;P&gt;for all the code&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;((index=ssys_pj OR index=other) NOT source=Bio_Mimics 
(Head Optimization Wizard ((started) OR (ended) OR (was selected) OR (num of missing) OR (Save voltage) OR (Support voltage) OR (Model voltage) OR (Target layer Net))) OR
(("Serial Number") OR ("Head Type") OR ("Maintenance counter")))
OR
( (index=ssys_pj OR index=other) source=*HQ.cfg OR source=*HM.cfg OR source=*HS.cfg AND (RequestedHeadVoltagesSupport OR RequestedHeadVoltagesModel ))
|`SerialNumber`
| search SerialNumber=*
|`Region`
| search Region=*
|`PrinterType`
| rex "Serial Number = (?&amp;lt;HeadSerialNumber&amp;gt;\S+)"
| rex field=HeadSerialNumber mode=sed "s/,//"
| rex "Head Type = (?&amp;lt;HeadType&amp;gt;[\w\ ]+)"
| rex "Head Optimization Wizard: (?&amp;lt;WizardMode&amp;gt;\S+) was selected"
| rex "Nozzles for head Head (?&amp;lt;head&amp;gt;\d+) is (?&amp;lt;missing_nozzles&amp;gt;\d+)"
| rex "physical Head Index = (?&amp;lt;head&amp;gt;\d+)"
| rex "Save voltage (?&amp;lt;Calibrated_voltage&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
| rex "Support voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
| rex "Model voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
| rex "Head Optimization Wizard: (?&amp;lt;wizard_ended&amp;gt;ended)"
| rex "Head Optimization Wizard: (?&amp;lt;wizard_started&amp;gt;started)"
| rex "Target layer Net\s+\=\s+(?&amp;lt;Layer&amp;gt;[\d\.]+)"
| eval startedTime=if(isnotnull(wizard_started),_time,null())
| eval startedSource=if(isnotnull(wizard_started),source,null())
| eval endedTime=if(isnotnull(wizard_ended),_time,null())
| eval endedSource=if(isnotnull(wizard_ended),source,null())
| rex "Maintenance counter \"H(?&amp;lt;head&amp;gt;\d+)\" Value is: (?&amp;lt;head_lifetime&amp;gt;\d+)"
| eventstats max(startedTime) as startedTime max(endedTime) as endedTime by SerialNumber
| where isnotnull(HeadSerialNumber) OR isnotnull(HeadType) OR (_time&amp;gt;=startedTime AND _time&amp;lt;=endedTime)
| sort 0 _time 
| streamstats last(Layer) as Layer  last(WizardMode) as WizardMode last(startedTime) as startedTime last(startedSource) as startedSource last(endedTime) as endedTime last(endedSource) as endedSource by SerialNumber
| stats last(endedSource) as endedSource last(startedSource) as startedSource max(startedTime) as startedTime max(endedTime) as endedTime last(*) as * by SerialNumber head
| search HeadSerialNumber=* HeadType=*
| lookup internal_Printers SN as SerialNumber OUTPUT  Type
| eval Internal=if(isnotnull(Type),"T","F")
| table startedTime endedTime Type Region Internal SerialNumber PrinterType head HeadSerialNumber HeadType missing_nozzles HeadVoltage HeadVoltageDate  Voltage_before_optimization Calibrated_voltage head_lifetime Layer WizardMode startedSource endedSource
| rename Calibrated_voltage as Calibrated_voltage_after_optimization

| rex field=source "PerMachine_(?&amp;lt;WizardMode&amp;gt;[^\.]+)" 
| eval WizardMode=if(WizardMode=="HM","HS/HM",WizardMode) 
| rex "RequestedHeadVoltagesSupport=(?&amp;lt;head0&amp;gt;[^,]+),(?&amp;lt;head1&amp;gt;[^,]+)," 
| rex "RequestedHeadVoltagesModel=[^,]+,[^,]+,(?&amp;lt;head2&amp;gt;[^,]+),(?&amp;lt;head3&amp;gt;[^,]+),(?&amp;lt;head4&amp;gt;[^,]+),(?&amp;lt;head5&amp;gt;[^,]+),(?&amp;lt;head6&amp;gt;[^,]+),(?&amp;lt;head7&amp;gt;[^,]+)"
| stats latest(*) as *  by SerialNumber Region
| table HeadVoltageDate Region SerialNumber WizardMode head*
| eval id=Region+"@"+SerialNumber+"@"+WizardMode+"@"+headVoltageDate
| table id head* 
| rename head* as *
| untable id head HeadVoltage
| eval id=split(id,"@")
| eval Region=mvindex(id,0)
| eval SerialNumber=mvindex(id,1)
| eval WizardMode=mvindex(id,2)
| eval HeadVoltageDate=mvindex(id,3)
| table  Region SerialNumber WizardMode head HeadVoltage HeadVoltageDate
|stats values(*) as * by Region SerialNumber  MachineMode head
| convert ctime(endedTime) ctime(startedTime) ctime(HeadVoltageDate) timeformat="%F %T"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 May 2019 11:29:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455674#M128848</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2019-05-15T11:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455675#M128849</link>
      <description>&lt;P&gt;i tries also something like this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=ssys_*_pj OR index=other) NOT source=*Bio_Mimics* 
(Head Optimization Wizard ((started) OR (ended) OR (was selected) OR (num of missing) OR (Save voltage) OR (Support voltage) OR (Model voltage) OR (Target layer Net))) OR
(("Serial Number") OR ("Head Type") OR ("Maintenance counter"))
|`SerialNumber`
| search SerialNumber=8500519
|`Region`
| search Region=*
|`PrinterType`
| rex "Serial Number = (?&amp;lt;HeadSerialNumber&amp;gt;\S+)"
| rex field=HeadSerialNumber mode=sed "s/,//"
| rex "Head Type = (?&amp;lt;HeadType&amp;gt;[\w\ ]+)"
| rex "Head Optimization Wizard: (?&amp;lt;WizardMode&amp;gt;\S+) was selected"
| rex "Nozzles for head Head (?&amp;lt;head&amp;gt;\d+) is (?&amp;lt;missing_nozzles&amp;gt;\d+)"
| rex "physical Head Index = (?&amp;lt;head&amp;gt;\d+)"
| rex "Save voltage (?&amp;lt;Calibrated_voltage&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
| rex "Support voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
| rex "Model voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
| rex "Head Optimization Wizard: (?&amp;lt;wizard_ended&amp;gt;ended)"
| rex "Head Optimization Wizard: (?&amp;lt;wizard_started&amp;gt;started)"
| rex "Target layer Net\s+\=\s+(?&amp;lt;Layer&amp;gt;[\d\.]+)"
| eval startedTime=if(isnotnull(wizard_started),_time,null())
| eval startedSource=if(isnotnull(wizard_started),source,null())
| eval endedTime=if(isnotnull(wizard_ended),_time,null())
| eval endedSource=if(isnotnull(wizard_ended),source,null())
| rex "Maintenance counter \"H(?&amp;lt;head&amp;gt;\d+)\" Value is: (?&amp;lt;head_lifetime&amp;gt;\d+)"
| eventstats max(startedTime) as startedTime max(endedTime) as endedTime by SerialNumber
| where isnotnull(HeadSerialNumber) OR isnotnull(HeadType) OR (_time&amp;gt;=startedTime AND _time&amp;lt;=endedTime)
| sort 0 _time 
| streamstats last(Layer) as Layer  last(WizardMode) as WizardMode last(startedTime) as startedTime last(startedSource) as startedSource last(endedTime) as endedTime last(endedSource) as endedSource by SerialNumber
| stats last(endedSource) as endedSource last(startedSource) as startedSource max(startedTime) as startedTime max(endedTime) as endedTime last(*) as * by SerialNumber head
| search HeadSerialNumber=* HeadType=*
| lookup internal_Printers SN as SerialNumber OUTPUT  Type
| eval Internal=if(isnotnull(Type),"T","F")
| table startedTime endedTime Region Internal SerialNumber PrinterType head HeadSerialNumber HeadType missing_nozzles HeadVoltage HeadVoltageDate  Voltage_before_optimization Calibrated_voltage head_lifetime Layer WizardMode startedSource endedSource
| rename Calibrated_voltage as Calibrated_voltage_after_optimization

| append
    [search (index=ssys_*_pj OR index=other) source=*HQ.cfg OR source=*HM.cfg OR source=*HS.cfg AND (RequestedHeadVoltagesSupport OR RequestedHeadVoltagesModel )
| `SerialNumber`
|`Region`
| rex field=source "PerMachine_(?&amp;lt;WizardMode&amp;gt;[^\.]+)" 
| eval WizardMode=if(WizardMode=="HM","HS/HM",WizardMode) 
| rex "RequestedHeadVoltagesSupport=(?&amp;lt;head0&amp;gt;[^,]+),(?&amp;lt;head1&amp;gt;[^,]+)," 
| rex "RequestedHeadVoltagesModel=[^,]+,[^,]+,(?&amp;lt;head2&amp;gt;[^,]+),(?&amp;lt;head3&amp;gt;[^,]+),(?&amp;lt;head4&amp;gt;[^,]+),(?&amp;lt;head5&amp;gt;[^,]+),(?&amp;lt;head6&amp;gt;[^,]+),(?&amp;lt;head7&amp;gt;[^,]+)"
| stats latest(*) as * max(_time) as headVoltageDate by SerialNumber Region
| table HeadVoltageDate Region SerialNumber WizardMode head*
| eval id=Region+"@"+SerialNumber+"@"+WizardMode+"@"+headVoltageDate
| table id head* 
| rename head* as *
| untable id head HeadVoltage
| eval id=split(id,"@")
| eval Region=mvindex(id,0)
| eval SerialNumber=mvindex(id,1)
| eval WizardMode=mvindex(id,2)
| eval HeadVoltageDate=mvindex(id,3)
| stats values(*) as * by  Region SerialNumber MachineMode head
| table  Region SerialNumber WizardMode head HeadVoltage HeadVoltageDate]

| convert ctime(endedTime) ctime(startedTime) ctime(HeadVoltageDate) timeformat="%F %T"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and it gives me only part of the results. (nothing from the second part of the query)&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 11:36:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455675#M128849</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2019-05-15T11:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455676#M128850</link>
      <description>&lt;P&gt;does this  give you results ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   ((index=ssys_pj OR index=other) NOT source=Bio_Mimics 
     (Head Optimization Wizard ((started) OR (ended) OR (was selected) OR (num of missing) OR (Save voltage) OR (Support voltage) OR (Model voltage) OR (Target layer Net))) OR
     (("Serial Number") OR ("Head Type") OR ("Maintenance counter")))
     OR
     ( (index=ssys_pj OR index=other) source=*HQ.cfg OR source=*HM.cfg OR source=*HS.cfg AND (RequestedHeadVoltagesSupport OR RequestedHeadVoltagesModel ))
     |`SerialNumber`
     | search SerialNumber=*
     |`Region`
     | search Region=*
     |`PrinterType`
     | rex "Serial Number = (?&amp;lt;HeadSerialNumber&amp;gt;\S+)"
     | rex field=HeadSerialNumber mode=sed "s/,//"
     | rex "Head Type = (?&amp;lt;HeadType&amp;gt;[\w\ ]+)"
     | rex "Head Optimization Wizard: (?&amp;lt;WizardMode&amp;gt;\S+) was selected"
     | rex "Nozzles for head Head (?&amp;lt;head&amp;gt;\d+) is (?&amp;lt;missing_nozzles&amp;gt;\d+)"
     | rex "physical Head Index = (?&amp;lt;head&amp;gt;\d+)"
     | rex "Save voltage (?&amp;lt;Calibrated_voltage&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
     | rex "Support voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
     | rex "Model voltage (?&amp;lt;Voltage_before_optimization&amp;gt;[\d\.]+) for head Head (?&amp;lt;head&amp;gt;\d+)"
     | rex "Head Optimization Wizard: (?&amp;lt;wizard_ended&amp;gt;ended)"
     | rex "Head Optimization Wizard: (?&amp;lt;wizard_started&amp;gt;started)"
     | rex "Target layer Net\s+\=\s+(?&amp;lt;Layer&amp;gt;[\d\.]+)"
     | eval startedTime=if(isnotnull(wizard_started),_time,null())
     | eval startedSource=if(isnotnull(wizard_started),source,null())
     | eval endedTime=if(isnotnull(wizard_ended),_time,null())
     | eval endedSource=if(isnotnull(wizard_ended),source,null())
     | rex "Maintenance counter \"H(?&amp;lt;head&amp;gt;\d+)\" Value is: (?&amp;lt;head_lifetime&amp;gt;\d+)"
     | eventstats max(startedTime) as startedTime max(endedTime) as endedTime by SerialNumber
     | where isnotnull(HeadSerialNumber) OR isnotnull(HeadType) OR (_time&amp;gt;=startedTime AND _time&amp;lt;=endedTime)
     | sort 0 _time 
     | streamstats last(Layer) as Layer  last(WizardMode) as WizardMode last(startedTime) as startedTime last(startedSource) as startedSource last(endedTime) as endedTime last(endedSource) as endedSource by SerialNumber
     | stats last(endedSource) as endedSource last(startedSource) as startedSource max(startedTime) as startedTime max(endedTime) as endedTime last(*) as * by SerialNumber head
     | search HeadSerialNumber=* HeadType=*
     | lookup internal_Printers SN as SerialNumber OUTPUT  Type
     | eval Internal=if(isnotnull(Type),"T","F")
     | table startedTime endedTime Type Region Internal SerialNumber PrinterType head HeadSerialNumber HeadType missing_nozzles HeadVoltage HeadVoltageDate  Voltage_before_optimization Calibrated_voltage head_lifetime Layer WizardMode startedSource endedSource
     | rename Calibrated_voltage as Calibrated_voltage_after_optimization

     | rex field=source "PerMachine_(?&amp;lt;WizardMode&amp;gt;[^\.]+)" 
     | eval WizardMode=if(WizardMode=="HM","HS/HM",WizardMode) 
     | rex "RequestedHeadVoltagesSupport=(?&amp;lt;head0&amp;gt;[^,]+),(?&amp;lt;head1&amp;gt;[^,]+)," 
     | rex "RequestedHeadVoltagesModel=[^,]+,[^,]+,(?&amp;lt;head2&amp;gt;[^,]+),(?&amp;lt;head3&amp;gt;[^,]+),(?&amp;lt;head4&amp;gt;[^,]+),(?&amp;lt;head5&amp;gt;[^,]+),(?&amp;lt;head6&amp;gt;[^,]+),(?&amp;lt;head7&amp;gt;[^,]+)"
     | stats latest(*) as *  by SerialNumber Region
     | table HeadVoltageDate Region SerialNumber WizardMode head*
     | eval id=Region+"@"+SerialNumber+"@"+WizardMode+"@"+headVoltageDate
     | table id head* 
     | rename head* as *
     | untable id head HeadVoltage
     | eval id=split(id,"@")
     | eval Region=mvindex(id,0)
     | eval SerialNumber=mvindex(id,1)
     | eval WizardMode=mvindex(id,2)
     | eval HeadVoltageDate=mvindex(id,3)
     | table  Region SerialNumber WizardMode head HeadVoltage HeadVoltageDate
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 May 2019 11:43:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455676#M128850</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-15T11:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: join two queries depends on common fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455677#M128851</link>
      <description>&lt;P&gt;no results.. &lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 11:49:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-queries-depends-on-common-fields/m-p/455677#M128851</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2019-05-15T11:49:31Z</dc:date>
    </item>
  </channel>
</rss>

