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
SplunkTrust
SplunkTrust

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
SplunkTrust
SplunkTrust

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!

Splunk Observability Cloud | Unified Identity - Now Available for Existing Splunk ...

Raise your hand if you’ve already forgotten your username or password when logging into an account. (We can’t ...

Index This | How many sides does a circle have?

February 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

Registration for Splunk University is Now Open!

Are you ready for an adventure in learning?   Brace yourselves because Splunk University is back, and it's ...