Getting Data In

How to extract the first and last start time (as conditional term) and only use them in a search?

sina_shafaei
Explorer

Hi Guys,

in my data I have time slots in this format:

starttime="1403032818"

for each field. the number of starttimes are 17 (search was run on the data in 17 different times) for the whole data and I only need to use the first and last start times in my search, for example if we assume the whole times like this: 140153402,...., 1402513801, 1403032818

I only need my search to run on the fields which contains the first (140153402) and the last (1403032818) start time and ignore the results regard the start times in between .

How can I add this conditional (?) term to my search?

Thank you so much in advance for your help.

0 Karma

somesoni2
Revered Legend

See this run anywhere example with two data inputs.

<form>
  <label>Two input Form</label>
  <description/>
  <fieldset submitButton="false">
    <input type="dropdown" token="sourcetype" searchWhenChanged="true">
      <label>Sourcetype</label>
      <populatingSearch fieldForLabel="sourcetype" fieldForValue="sourcetype">index=_internal | stats count  by sourcetype</populatingSearch>
    </input>
    <input type="dropdown" token="source" searchWhenChanged="true">
          <label>Source</label>
          <populatingSearch fieldForLabel="source" fieldForValue="source">index=_internal | stats count  by source</populatingSearch>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <searchString>index=_internal sourcetype=$sourcetype$ source=$source$| timechart count</searchString>
        <earliestTime>-60m@m</earliestTime>
        <latestTime>now</latestTime>        
        <option name="wrap">true</option>
        <option name="rowNumbers">false</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">cell</option>
      </table>
    </panel>
  </row>
</form>
0 Karma

somesoni2
Revered Legend

What is your current search query?

0 Karma

sina_shafaei
Explorer

it's just a normal query e.g showing a table based for two variables. actually I want to use this "start time" as a variable (using an input like drop-down menu) for my dashboard (form) to choose the result based on first or last or both times and ignore the other start times and results related to them, but I have no idea how to do that?

I've used it for normal search like this:

index=remedy 1403032818 OR 140153402 | (rest of the search) ....

but for a form using drop-down menu ...?

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...