<?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 How to find field values from the results of a search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-field-values-from-the-results-of-a-search/m-p/657451#M227087</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a search as shown below which gives me the start time (start_run), end time (end_run) and duration when the value of (ValueE) is greater than 20 for the Instrument (my_inst_226).&lt;/P&gt;
&lt;P&gt;I need to get the values (ValueE) from 11 other Instrument for the duration of&amp;nbsp;my_inst_226 while ValueE is greater than 20&lt;/P&gt;
&lt;P&gt;I would like to use "start_run" and "end_run"&amp;nbsp; to find the value of (ValueE).&amp;nbsp; I'm thinking that "start_run" and "end_run" would be variables that I can use when searching the ValueE for my 11 other Instruments but I am stuck on how I can use "start_run" and "end_run" for the next stage of my search.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;index=my_index_plant sourcetype=my_sourcetype_plant Instrument="my_inst_226"&lt;BR /&gt;| sort 0 Instrument _time&lt;BR /&gt;| streamstats global=false window=1 current=false last(ValueE) as previous by Instrument&lt;BR /&gt;| eval current_over=if(ValueE &amp;gt; 20, 1, 0)&lt;BR /&gt;| eval previous_over=if(previous &amp;gt; 20, 1, 0)&lt;BR /&gt;| eval start=if(current_over=1 and previous_over=0,1,0)&lt;BR /&gt;| eval end=if(current_over=0 and previous_over=1,1,0)&lt;BR /&gt;| where start=1 OR end=1&lt;BR /&gt;| eval start_run=if(start=1, _time, null())&lt;BR /&gt;| eval end_run=if(end=1, _time, null())&lt;BR /&gt;| filldown start_run end_run&lt;BR /&gt;| eval run_duration=end_run-start_run&lt;BR /&gt;| eval check=_time&lt;BR /&gt;| where end=1&lt;BR /&gt;| streamstats count as run_id&lt;BR /&gt;| eval earliest=strftime(start_run, "%F %T")&lt;BR /&gt;| eval latest=strftime(end_run, "%F %T")&lt;BR /&gt;| eval run_duration=tostring(run_duration, "duration")&lt;BR /&gt;| table run_id earliest latest start_run end_run run_duration current_over previous_over end Instrument ValueE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any and all tips, help and advice will be gratefully received.&lt;/P&gt;</description>
    <pubDate>Thu, 14 Sep 2023 17:10:05 GMT</pubDate>
    <dc:creator>ewanbrown967</dc:creator>
    <dc:date>2023-09-14T17:10:05Z</dc:date>
    <item>
      <title>How to find field values from the results of a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-field-values-from-the-results-of-a-search/m-p/657451#M227087</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a search as shown below which gives me the start time (start_run), end time (end_run) and duration when the value of (ValueE) is greater than 20 for the Instrument (my_inst_226).&lt;/P&gt;
&lt;P&gt;I need to get the values (ValueE) from 11 other Instrument for the duration of&amp;nbsp;my_inst_226 while ValueE is greater than 20&lt;/P&gt;
&lt;P&gt;I would like to use "start_run" and "end_run"&amp;nbsp; to find the value of (ValueE).&amp;nbsp; I'm thinking that "start_run" and "end_run" would be variables that I can use when searching the ValueE for my 11 other Instruments but I am stuck on how I can use "start_run" and "end_run" for the next stage of my search.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;index=my_index_plant sourcetype=my_sourcetype_plant Instrument="my_inst_226"&lt;BR /&gt;| sort 0 Instrument _time&lt;BR /&gt;| streamstats global=false window=1 current=false last(ValueE) as previous by Instrument&lt;BR /&gt;| eval current_over=if(ValueE &amp;gt; 20, 1, 0)&lt;BR /&gt;| eval previous_over=if(previous &amp;gt; 20, 1, 0)&lt;BR /&gt;| eval start=if(current_over=1 and previous_over=0,1,0)&lt;BR /&gt;| eval end=if(current_over=0 and previous_over=1,1,0)&lt;BR /&gt;| where start=1 OR end=1&lt;BR /&gt;| eval start_run=if(start=1, _time, null())&lt;BR /&gt;| eval end_run=if(end=1, _time, null())&lt;BR /&gt;| filldown start_run end_run&lt;BR /&gt;| eval run_duration=end_run-start_run&lt;BR /&gt;| eval check=_time&lt;BR /&gt;| where end=1&lt;BR /&gt;| streamstats count as run_id&lt;BR /&gt;| eval earliest=strftime(start_run, "%F %T")&lt;BR /&gt;| eval latest=strftime(end_run, "%F %T")&lt;BR /&gt;| eval run_duration=tostring(run_duration, "duration")&lt;BR /&gt;| table run_id earliest latest start_run end_run run_duration current_over previous_over end Instrument ValueE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any and all tips, help and advice will be gratefully received.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 17:10:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-field-values-from-the-results-of-a-search/m-p/657451#M227087</guid>
      <dc:creator>ewanbrown967</dc:creator>
      <dc:date>2023-09-14T17:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Finding field values from the results of a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-field-values-from-the-results-of-a-search/m-p/657545#M227122</link>
      <description>&lt;P&gt;The most blunt way to implement this would be to use the constraint on ValueE as subsearch to establish search period (earliest, latest). &amp;nbsp;I will assume that ValueE and all the other 11 values are already extracted by Splunk. &amp;nbsp;I will call them other_field01, other_field02, etc.&lt;/P&gt;&lt;P&gt;Here is an idea if you are only interested in distinct values of these.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=my_index_plant sourcetype=my_sourcetype_plant
    [index=my_index_plant sourcetype=my_sourcetype_plant Instrument="my_inst_226" ValueE &amp;gt; 20
    | stats min(_time) as earliest max(_time) as latest]
| stats values(other_field01) as other_field01 values(other_field02) as other_field02, ... values(ValueE) as ValueE by Instrument&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 07:15:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-field-values-from-the-results-of-a-search/m-p/657545#M227122</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-09-14T07:15:24Z</dc:date>
    </item>
  </channel>
</rss>

