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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...