<?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: Multi-Field Subsearch or Pivot or Join on sources... I'm Lost. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240727#M71554</link>
    <description>&lt;P&gt;So simplifying what we are doing:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=bcoat_proxysg earliest=early latest=late [ search sourcetype=sep:ids earliest=1441065601 "BadString" | eval time=substr(begin_time,8,26) | eval epc=time | convert timeformat="%Y-%m-%d %H:%M:%S" mktime(epc) | eval early=(epc-300) | eval late=(epc+300) | table L_IP,early,late ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Gives this error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Invalid value "early" for time term 'earliest'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So just to be clear I wasn't combining the Table command with the fields creation command, I was just using it to validate the data was coming out in a format that was usable, with epoch times and an IP.&lt;/P&gt;

&lt;P&gt;Trying it without the table and trying to pass up the fields gets nothing no error just nothing: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=bcoat_proxysg [ search sourcetype=sep:ids earliest=1441065601 "Nuclear" | eval time=substr(begin_time,8,26) | eval epc=time | convert timeformat="%Y-%m-%d %H:%M:%S" mktime(epc) | eval early=(epc-300) | eval late=(epc+300) | fields + late | rename late as latest | fields + early | rename early as earliest | fields + L_IP ]

index=bcoat_proxysg [ search sourcetype=sep:ids earliest=1441065601 "Nuclear" | eval time=substr(begin_time,8,26) | eval epc=time | convert timeformat="%Y-%m-%d %H:%M:%S" mktime(epc) | eval early=(epc-300) | eval late=(epc+300) | fields + late | rename late as latest | fields + early | rename early as earliest | fields + L_IP ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Starting to wonder if I need to store results as a temp table and then loop through it? Full Disclosure I did not configure this environment  nor am I a splunk pro, there may be some oddities in the environment that cause it to perform differently.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 09 May 2016 14:12:31 GMT</pubDate>
    <dc:creator>greco7760</dc:creator>
    <dc:date>2016-05-09T14:12:31Z</dc:date>
    <item>
      <title>Multi-Field Subsearch or Pivot or Join on sources... I'm Lost.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240720#M71547</link>
      <description>&lt;P&gt;Short story, alert results to populate proxy query of dependent time ranges.&lt;/P&gt;

&lt;P&gt;Longer story-&lt;BR /&gt;
So essentially lets say I have a string that shows in my repository of SEP:IDS logs. &lt;/P&gt;

&lt;P&gt;I have a query that shows me a summary of IPs and then calculates a +- 5min field as such&lt;/P&gt;

&lt;P&gt;search sourcetype=sep:ids earliest=1441065601 "NaStY AtTaCkEr StRiNg" | eval time=substr(begin_time,8,26) | eval epc=time | convert timeformat="%Y-%m-%d %H:%M:%S" mktime(epc) | eval early=(epc-300) | eval late=(epc+300) | fields + late | rename late as latest | fields + early | rename early as earliest | fields + L_IP&lt;/P&gt;

&lt;P&gt;The time field is a substring from the raw data as the original carve out has some garbage at the front and I don't want that. After that the time string is converted to a time format, then to an epoch format to I can have some calculated fields  on plus and minus 5 min. The L_IP field is another carved field for the IP of the victim or local machine generating the alert.&lt;/P&gt;

&lt;P&gt;Running the query without the field push-ups and simply making a table works easy:&lt;/P&gt;

&lt;P&gt;... eval epc=time | convert timeformat="%Y-%m-%d %H:%M:%S" mktime(epc) | eval early=(epc-300) | eval late=(epc+300) | table L_IP,time,early,late&lt;/P&gt;

&lt;P&gt;But I want to take each alert and the +- range to query the proxy logs for those IPs in those time ranges to do some correlation with the IDS alerts and activity etc.&lt;/P&gt;

&lt;P&gt;When I use this as a sub-query pushing up the field values I get nothing, I know some of these won't have proxy logs and that there is a limit to what a sub query can push back, but getting nothing is a problem as manually the data is there.&lt;/P&gt;

&lt;P&gt;Is there a splunk Ninja out there who can point me in the proper direction?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:39:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240720#M71547</guid>
      <dc:creator>greco7760</dc:creator>
      <dc:date>2020-09-29T09:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Field Subsearch or Pivot or Join on sources... I'm Lost.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240721#M71548</link>
      <description>&lt;P&gt;I don't understand the use of fields commands.  I believe the earliest and latest are conflicting with internal field names (earliest and latest).  Try naming them something different:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ...   | eval epc_earliest=(epc-300) | eval epc_latest=(epc+300) | table L_IP,time,epc_earliest,epc_latest
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then when you use it as a sub search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=indexYoureCorrelatingWith  earliest=epc_earliest latest=epc_latest [ search ...   | eval epc_earliest=(epc-300) | eval epc_latest=(epc+300) | table L_IP,time,epc_earliest,epc_latest] 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 May 2016 01:37:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240721#M71548</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-05-07T01:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Field Subsearch or Pivot or Join on sources... I'm Lost.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240722#M71549</link>
      <description>&lt;P&gt;The use of the internal fields is intentional. So maybe I should state it simpler.&lt;/P&gt;

&lt;P&gt;Query for bad string in IDS logs&lt;/P&gt;

&lt;P&gt;From results carve out host IP and time&lt;/P&gt;

&lt;P&gt;Calculate 5 min earlier and 5 min later&lt;/P&gt;

&lt;P&gt;Pass resulting IP, earliest time, latest time to a query or proxy logs&lt;/P&gt;

&lt;P&gt;Do post analysis of resultant traffic history on proxies surrounding alert on host.   &lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2016 04:23:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240722#M71549</guid>
      <dc:creator>greco7760</dc:creator>
      <dc:date>2016-05-07T04:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Field Subsearch or Pivot or Join on sources... I'm Lost.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240723#M71550</link>
      <description>&lt;P&gt;query OF* proxy logs&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2016 04:24:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240723#M71550</guid>
      <dc:creator>greco7760</dc:creator>
      <dc:date>2016-05-07T04:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Field Subsearch or Pivot or Join on sources... I'm Lost.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240724#M71551</link>
      <description>&lt;P&gt;The use of the FIELDS commands is what I dont understand.&lt;/P&gt;

&lt;P&gt;Try it without the time field.&lt;BR /&gt;
       index=indexYoureCorrelatingWith  [ search ...   | eval epc_earliest=(epc-300) | eval epc_latest=(epc+300) | table L_IP,earliest,latest] &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:39:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240724#M71551</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-09-29T09:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Field Subsearch or Pivot or Join on sources... I'm Lost.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240725#M71552</link>
      <description>&lt;P&gt;Oops, i thought the field designation was how you formatted the field being pushed up. Ill try that this afternoon. &lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2016 15:48:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240725#M71552</guid>
      <dc:creator>greco7760</dc:creator>
      <dc:date>2016-05-07T15:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Field Subsearch or Pivot or Join on sources... I'm Lost.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240726#M71553</link>
      <description>&lt;P&gt;The table command is doing the work of the fields commands.  I usually only use the fields command when I need to remove fields.&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2016 17:24:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240726#M71553</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-05-07T17:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Field Subsearch or Pivot or Join on sources... I'm Lost.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240727#M71554</link>
      <description>&lt;P&gt;So simplifying what we are doing:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=bcoat_proxysg earliest=early latest=late [ search sourcetype=sep:ids earliest=1441065601 "BadString" | eval time=substr(begin_time,8,26) | eval epc=time | convert timeformat="%Y-%m-%d %H:%M:%S" mktime(epc) | eval early=(epc-300) | eval late=(epc+300) | table L_IP,early,late ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Gives this error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Invalid value "early" for time term 'earliest'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So just to be clear I wasn't combining the Table command with the fields creation command, I was just using it to validate the data was coming out in a format that was usable, with epoch times and an IP.&lt;/P&gt;

&lt;P&gt;Trying it without the table and trying to pass up the fields gets nothing no error just nothing: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=bcoat_proxysg [ search sourcetype=sep:ids earliest=1441065601 "Nuclear" | eval time=substr(begin_time,8,26) | eval epc=time | convert timeformat="%Y-%m-%d %H:%M:%S" mktime(epc) | eval early=(epc-300) | eval late=(epc+300) | fields + late | rename late as latest | fields + early | rename early as earliest | fields + L_IP ]

index=bcoat_proxysg [ search sourcetype=sep:ids earliest=1441065601 "Nuclear" | eval time=substr(begin_time,8,26) | eval epc=time | convert timeformat="%Y-%m-%d %H:%M:%S" mktime(epc) | eval early=(epc-300) | eval late=(epc+300) | fields + late | rename late as latest | fields + early | rename early as earliest | fields + L_IP ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Starting to wonder if I need to store results as a temp table and then loop through it? Full Disclosure I did not configure this environment  nor am I a splunk pro, there may be some oddities in the environment that cause it to perform differently.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2016 14:12:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240727#M71554</guid>
      <dc:creator>greco7760</dc:creator>
      <dc:date>2016-05-09T14:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Field Subsearch or Pivot or Join on sources... I'm Lost.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240728#M71555</link>
      <description>&lt;P&gt;same here... not a splunk pro! &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I'm terrible at subsearches for sure:&lt;/P&gt;

&lt;P&gt;I referenced another answer to come up with the below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=bcoat_proxysg  [ search sourcetype=sep:ids earliest=1441065601 "BadString" | eval time=substr(begin_time,8,26) | eval epc=time | convert timeformat="%Y-%m-%d %H:%M:%S" mktime(epc) | eval earliest=(epc-300) | eval latest=(epc+300) | table L_IP,earliest,latest | format "(" "(" "" ")" "OR" ")"  ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/136791/use-a-subsearch-to-define-earliest-and-latest-for-main-search.html"&gt;https://answers.splunk.com/answers/136791/use-a-subsearch-to-define-earliest-and-latest-for-main-search.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2016 15:11:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240728#M71555</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-05-09T15:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Field Subsearch or Pivot or Join on sources... I'm Lost.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240729#M71556</link>
      <description>&lt;P&gt;No dice. (-_-) I got 0 results so it is trying but something is breaking.&lt;/P&gt;

&lt;P&gt;I am experimenting with writing to a lookuptable and then referencing it.&lt;/P&gt;

&lt;P&gt;If it works I will post.&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2016 15:21:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240729#M71556</guid>
      <dc:creator>greco7760</dc:creator>
      <dc:date>2016-05-09T15:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Field Subsearch or Pivot or Join on sources... I'm Lost.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240730#M71557</link>
      <description>&lt;P&gt;are the timestamps correct in both indexes?  same timezone, etc?&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2016 15:47:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240730#M71557</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-05-09T15:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Field Subsearch or Pivot or Join on sources... I'm Lost.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240731#M71558</link>
      <description>&lt;P&gt;OK looking at the logs for that query this is the closest to working this has gotten so far.&lt;/P&gt;

&lt;P&gt;The literal search it creates looks like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;litsearch source=bcoat_proxysg ( ( L_IP="10.36.186.202" _time&amp;gt;=1461763562.000 _time&amp;lt;1461764162.000 ) OR ( L_IP="10.20.222.118" _time&amp;gt;=1461589740.000 _time&amp;lt;1461590340.000 ) OR ( L_IP="192.168.1.78" _time&amp;gt;=1461797959.000 _time&amp;lt;1461798559.000 ) OR ( L_IP="10.10.15.87" _time&amp;gt;=1461608960.000 _time&amp;lt;1461609560.000 ) OR ( L_IP="192.168.12.51" _time&amp;gt;=1461937767.000 _time&amp;lt;1461938367.000 ) OR ( L_IP="192.168.178.16" _time&amp;gt;=1461955982.000 _time&amp;lt;1461956582.000 ) OR ...............
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and it just goes on. So essentially it is creating a long literal search and the times are getting handles appropriately. The problem, I think, is that the IP is retaining its label and in the proxy logs that field isn't named like that. How do I get it to pass up just the IP value and not the field name? &lt;/P&gt;

&lt;P&gt;I fully expect no results from 192 ranges as the user was clearly offsite, but the internal IPs should generate results and do generate results when run manually.&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2016 19:45:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240731#M71558</guid>
      <dc:creator>greco7760</dc:creator>
      <dc:date>2016-05-09T19:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Field Subsearch or Pivot or Join on sources... I'm Lost.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240732#M71559</link>
      <description>&lt;P&gt;You do it more or less like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=sep:ids earliest=1441065601 "BadString" 
| eval epc=strptime(substr(begin_time,8,26),"%Y-%m-%d %H:%M:%S")
| eval early=(epc-300) 
| eval late=(epc+300) 
| eval badIP = L_IP
| table badIP,early,late 

| rename COMMENT as "The above search gets your various values, then you run them into the actual search like this..."

| map search="search index=foo earliest=$early$ latest=$late$ L_IP=$badIP$  (the rest of your search here)" maxsearches=100 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or, if &lt;CODE&gt;L_IP&lt;/CODE&gt; doesn't exist as a field but the IP value is somewhere in the &lt;CODE&gt;_raw&lt;/CODE&gt; as a literal...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| map search="search index=foo earliest=$early$ latest=$late$ \"$badIP$\"  (the rest of your search here)" maxsearches=100 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Apr 2017 22:26:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-Field-Subsearch-or-Pivot-or-Join-on-sources-I-m-Lost/m-p/240732#M71559</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-04-19T22:26:50Z</dc:date>
    </item>
  </channel>
</rss>

