<?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: How to dynamic assign variable to maxspan and span in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-dynamic-assign-variable-to-maxspan-and-span/m-p/398008#M115470</link>
    <description>&lt;H2&gt;I tried using the map command in my index but my lookup return is getting messed up also the maxspan is not taking effect. Below is my updated script:&lt;/H2&gt;

&lt;P&gt;| search Id="*" &lt;BR /&gt;
| lookup error_rules.csv EventSubType OUTPUT alert_type span_time check_reoccurrence_window reoccurrence_threshold_count check_reoccurrence_window_limit &lt;/P&gt;

&lt;P&gt;| table Id PublisherMessage EventSubType PublisherTimestamp alert_type span_time check_reoccurrence_window reoccurrence_threshold_count check_reoccurrence_window_limit &lt;BR /&gt;
| map search="search index=* | transaction Id PublisherMessage  maxspan=$span_time$"&lt;/P&gt;

&lt;TABLE&gt;&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH&gt;stats list(PublisherTimestamp) AS EventTimeStamp list(sourcetype) AS SourceOfData list(EventSubType) AS EventSubType list(span_time) as SpanTimeLimit list(reoccurrence_threshold_count) AS ReoccurenceThresholdCount list(check_reoccurrence_window_limit) list(duration1) count by Id PublisherMessage _time&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;&lt;TBODY&gt;
&lt;/TBODY&gt;&lt;/TABLE&gt;

&lt;HR /&gt;

&lt;P&gt;Lookup File:&lt;BR /&gt;
EventSubType,alert_type,spam_time,check_reoccurrence_window,reoccurrence_threshold_count,check_reoccurrence_window_limit&lt;/P&gt;

&lt;P&gt;Failed to Ping Computer,Critical,7m,0,0,0&lt;BR /&gt;
Application Error,Warning,5m,0,0,0&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 23:28:28 GMT</pubDate>
    <dc:creator>mpaw</dc:creator>
    <dc:date>2020-09-29T23:28:28Z</dc:date>
    <item>
      <title>How to dynamic assign variable to maxspan and span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-dynamic-assign-variable-to-maxspan-and-span/m-p/398004#M115466</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;H2&gt;I want to create a dynamic variable containing the span value on my index search. I have a lookup file that has corresponding value then it will lookup to the index search and update the span value. Unfortunately, I cannot get it to work. Any tips/ideas?&lt;/H2&gt;

&lt;P&gt;Instead of:&lt;BR /&gt;
maxspan=7m; span=240m&lt;/P&gt;

&lt;P&gt;It will be like this:&lt;/P&gt;

&lt;H2&gt;maxspan=duration1; span=duration1&lt;/H2&gt;

&lt;P&gt;Here is my script below:&lt;BR /&gt;
| search Id="*" &lt;BR /&gt;
| lookup error_rules.csv EventSubType as EventSubType OUTPUT alert_type span_time check_reoccurrence_window reoccurrence_threshold_count check_reoccurrence_window_limit &lt;BR /&gt;
| eval recorrenceWindow=$span_time$ &lt;BR /&gt;
| eval duration=floor($recorrenceWindow$) &lt;BR /&gt;
| eval duration1=duration+"m" &lt;BR /&gt;
| transaction Id PublisherMessage maxspan=7m &lt;BR /&gt;
| convert timeformat="%Y-%m-%d %H:%M:%S" ctime(_time) AS c_time &lt;BR /&gt;
| bucket _time span=240m &lt;/P&gt;

&lt;H2&gt;| stats list(PublisherTimestamp) AS EventTimeStamp list(sourcetype) AS SourceOfData list(EventSubType) AS EventSubType list(span_time) as SpanTimeLimit list(reoccurrence_threshold_count) AS ReoccurenceThresholdCount list(check_reoccurrence_window_limit) list(duration1) count by Id PublisherMessage _time&lt;/H2&gt;

&lt;P&gt;Lookup File:&lt;BR /&gt;
EventSubType,alert_type,spam_time,check_reoccurrence_window,reoccurrence_threshold_count,check_reoccurrence_window_limit&lt;BR /&gt;
Failed to Ping Computer,Critical,7,0,0,0&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:21:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-dynamic-assign-variable-to-maxspan-and-span/m-p/398004#M115466</guid>
      <dc:creator>mpaw</dc:creator>
      <dc:date>2020-09-29T23:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamic assign variable to maxspan and span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-dynamic-assign-variable-to-maxspan-and-span/m-p/398005#M115467</link>
      <description>&lt;P&gt;Define the field upfront and pass it to the map command like this example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval field="member_guid" 
| map search="search index=_internal 
| transaction $field$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Feb 2019 14:23:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-dynamic-assign-variable-to-maxspan-and-span/m-p/398005#M115467</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2019-02-26T14:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamic assign variable to maxspan and span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-dynamic-assign-variable-to-maxspan-and-span/m-p/398006#M115468</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval maxspan="7m"
| map search="search index=_* | transaction host maxspan=$maxspan$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Mar 2019 06:58:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-dynamic-assign-variable-to-maxspan-and-span/m-p/398006#M115468</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-03-01T06:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamic assign variable to maxspan and span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-dynamic-assign-variable-to-maxspan-and-span/m-p/398007#M115469</link>
      <description>&lt;P&gt;@mpaw  please accept an answer if it solved/helped it and upvote it. Otherwise let us know how can we help further&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2019 11:08:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-dynamic-assign-variable-to-maxspan-and-span/m-p/398007#M115469</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2019-03-01T11:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamic assign variable to maxspan and span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-dynamic-assign-variable-to-maxspan-and-span/m-p/398008#M115470</link>
      <description>&lt;H2&gt;I tried using the map command in my index but my lookup return is getting messed up also the maxspan is not taking effect. Below is my updated script:&lt;/H2&gt;

&lt;P&gt;| search Id="*" &lt;BR /&gt;
| lookup error_rules.csv EventSubType OUTPUT alert_type span_time check_reoccurrence_window reoccurrence_threshold_count check_reoccurrence_window_limit &lt;/P&gt;

&lt;P&gt;| table Id PublisherMessage EventSubType PublisherTimestamp alert_type span_time check_reoccurrence_window reoccurrence_threshold_count check_reoccurrence_window_limit &lt;BR /&gt;
| map search="search index=* | transaction Id PublisherMessage  maxspan=$span_time$"&lt;/P&gt;

&lt;TABLE&gt;&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH&gt;stats list(PublisherTimestamp) AS EventTimeStamp list(sourcetype) AS SourceOfData list(EventSubType) AS EventSubType list(span_time) as SpanTimeLimit list(reoccurrence_threshold_count) AS ReoccurenceThresholdCount list(check_reoccurrence_window_limit) list(duration1) count by Id PublisherMessage _time&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;&lt;TBODY&gt;
&lt;/TBODY&gt;&lt;/TABLE&gt;

&lt;HR /&gt;

&lt;P&gt;Lookup File:&lt;BR /&gt;
EventSubType,alert_type,spam_time,check_reoccurrence_window,reoccurrence_threshold_count,check_reoccurrence_window_limit&lt;/P&gt;

&lt;P&gt;Failed to Ping Computer,Critical,7m,0,0,0&lt;BR /&gt;
Application Error,Warning,5m,0,0,0&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:28:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-dynamic-assign-variable-to-maxspan-and-span/m-p/398008#M115470</guid>
      <dc:creator>mpaw</dc:creator>
      <dc:date>2020-09-29T23:28:28Z</dc:date>
    </item>
  </channel>
</rss>

