<?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: appendcols to take values from my first search for each row in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/appendcols-to-take-values-from-my-first-search-for-each-row/m-p/305682#M91745</link>
    <description>&lt;P&gt;hi &lt;/P&gt;

&lt;P&gt;Sorry. No look there as&lt;/P&gt;

&lt;P&gt;Invalid value "$Start_epoc$" for time term 'earliest'&lt;/P&gt;

&lt;P&gt;I think as both searches run together i have to pass the earlist into the second search for each row.&lt;BR /&gt;
THere migh be 100 rows, so i need the second search to run each time with different earliest=$Start_epoc$ latest=$Stop_epoc$ from the first search.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 18:48:29 GMT</pubDate>
    <dc:creator>robertlynch2020</dc:creator>
    <dc:date>2020-09-29T18:48:29Z</dc:date>
    <item>
      <title>appendcols to take values from my first search for each row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appendcols-to-take-values-from-my-first-search-for-each-row/m-p/305680#M91743</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I need my appendcols to take values from my first search. Specifically two values of time produce in the first search  Start_epoc and Stop_epoc. For each row as the first search will produce multiple rows, and i need the second search to produce the same amount.&lt;/P&gt;

&lt;P&gt;Then i want to use them in the second search like below.&lt;/P&gt;

&lt;P&gt;earliest=$Start_epoc$ latest=$Stop_epoc$.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup Saved_Tests.csv 
| where Host="UBS-RC_QCST_MASTER" 
| where 1=1 
| search Dev_Optimization="*" 
| search Functional_Optimization="*" 
| eval Start_epoc=Start 
| eval Stop_epoc=Stop 
| convert ctime(Start) 
| convert ctime(Stop) 
| table ID, host,  Start_epoc , Stop_epoc 
| head 1001 
| sort 0 - by ID |  appendcols [| tstats count where index="mlc_live" host=UBS-RC_QCST_MASTER sourcetype="MX_TIMING2" earliest=$Start_epoc$ latest=$Stop_epoc$   by _indextime host 
| stats sum(count) as No_Of_MXTIMING_lines  by host 
| table No_Of_MXTIMING_lines ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:47:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appendcols-to-take-values-from-my-first-search-for-each-row/m-p/305680#M91743</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2020-09-29T18:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: appendcols to take values from my first search for each row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appendcols-to-take-values-from-my-first-search-for-each-row/m-p/305681#M91744</link>
      <description>&lt;P&gt;I have modified the query as per your comment&lt;/P&gt;

&lt;P&gt;Could you please try this query &lt;/P&gt;

&lt;P&gt;| inputlookup Saved_Tests.csv &lt;BR /&gt;
 | where Host="UBS-RC_QCST_MASTER" &lt;BR /&gt;
 | where 1=1 &lt;BR /&gt;
 | search Dev_Optimization="&lt;EM&gt;" &lt;BR /&gt;
 | search Functional_Optimization="&lt;/EM&gt;" &lt;BR /&gt;
 | eval Start_epoc=Start &lt;BR /&gt;
 | eval Stop_epoc=Stop &lt;BR /&gt;
 | convert ctime(Start) &lt;BR /&gt;
 | convert ctime(Stop) &lt;BR /&gt;
 | table ID, host,  Start_epoc , Stop_epoc &lt;BR /&gt;
 | head 1001 &lt;BR /&gt;
 | sort 0 - by ID |  join Start_epoc Stop_epoc   [search | tstats count where index="mlc_live" host=UBS-RC_QCST_MASTER sourcetype="MX_TIMING2" earliest=Start_epoc latest=Stop_epoc   by _indextime host &lt;BR /&gt;
 | stats sum(count) as No_Of_MXTIMING_lines  by host &lt;BR /&gt;
 | table No_Of_MXTIMING_lines ]&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:47:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appendcols-to-take-values-from-my-first-search-for-each-row/m-p/305681#M91744</guid>
      <dc:creator>logloganathan</dc:creator>
      <dc:date>2020-09-29T18:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: appendcols to take values from my first search for each row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appendcols-to-take-values-from-my-first-search-for-each-row/m-p/305682#M91745</link>
      <description>&lt;P&gt;hi &lt;/P&gt;

&lt;P&gt;Sorry. No look there as&lt;/P&gt;

&lt;P&gt;Invalid value "$Start_epoc$" for time term 'earliest'&lt;/P&gt;

&lt;P&gt;I think as both searches run together i have to pass the earlist into the second search for each row.&lt;BR /&gt;
THere migh be 100 rows, so i need the second search to run each time with different earliest=$Start_epoc$ latest=$Stop_epoc$ from the first search.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:48:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appendcols-to-take-values-from-my-first-search-for-each-row/m-p/305682#M91745</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2020-09-29T18:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: appendcols to take values from my first search for each row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appendcols-to-take-values-from-my-first-search-for-each-row/m-p/305683#M91746</link>
      <description>&lt;P&gt;I have edited the answer as per your comment. Could you please try that query&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 08:54:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appendcols-to-take-values-from-my-first-search-for-each-row/m-p/305683#M91746</guid>
      <dc:creator>logloganathan</dc:creator>
      <dc:date>2018-03-29T08:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: appendcols to take values from my first search for each row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appendcols-to-take-values-from-my-first-search-for-each-row/m-p/305684#M91747</link>
      <description>&lt;P&gt;Considering sources for both your searches are faster (lookup table file and tstats query), you can use &lt;CODE&gt;map&lt;/CODE&gt; command like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup Saved_Tests.csv 
 | where Host="UBS-RC_QCST_MASTER" 
 | where 1=1 
 | search Dev_Optimization="*" 
 | search Functional_Optimization="*" 
 | eval Start_epoc=Start 
 | eval Stop_epoc=Stop 
 | convert ctime(Start) 
 | convert ctime(Stop) 
 | table ID, host,  Start_epoc , Stop_epoc 
 | head 1001 
 |  map maxsearches=1001 search="| tstats count where index=mlc_live host=UBS-RC_QCST_MASTER sourcetype=MX_TIMING2 earliest=$Start_epoc$ latest=$Stop_epoc$   by _indextime host 
 | stats sum(count) as No_Of_MXTIMING_lines  by host | eval ID=\"$ID$\" | eval Start_epoch=$Start_epoc$ | eval Stop_epoc=$Stop_epoc$"
| sort 0 - by ID 
 |  table ID, host,  Start_epoc , Stop_epoc No_Of_MXTIMING_lines
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Mar 2018 09:31:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appendcols-to-take-values-from-my-first-search-for-each-row/m-p/305684#M91747</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-03-29T09:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: appendcols to take values from my first search for each row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appendcols-to-take-values-from-my-first-search-for-each-row/m-p/305685#M91748</link>
      <description>&lt;P&gt;Super super thanks so much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Also by changing the second search to tstats with out stats it goes much quicker&lt;/P&gt;

&lt;P&gt;| map maxsearches=20 search="| tstats summariesonly=true count(MXTIMING.Elapsed) as No_Of_MXTIMING_lines FROM datamodel=MXTIMING_V7 WHERE &lt;BR /&gt;
    host=QCST_RSAT_40 earliest=$Start_epoc$ latest=$Stop_epoc$ &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:53:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appendcols-to-take-values-from-my-first-search-for-each-row/m-p/305685#M91748</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2020-09-29T18:53:04Z</dc:date>
    </item>
  </channel>
</rss>

