<?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 can I pass a variable to the tail command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-a-variable-to-the-tail-command/m-p/147954#M41365</link>
    <description>&lt;P&gt;One possibility is to get the dynamic value via a subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | tail [ | stats count | eval search=10 | fields search ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That will effectively expand to a search that looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=_internal | tail ((10))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So in your case just come up with a subsearch that dynamically obtains your value.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Dec 2014 20:10:29 GMT</pubDate>
    <dc:creator>jhupka</dc:creator>
    <dc:date>2014-12-10T20:10:29Z</dc:date>
    <item>
      <title>How can I pass a variable to the tail command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-a-variable-to-the-tail-command/m-p/147953#M41364</link>
      <description>&lt;P&gt;... &lt;BR /&gt;
| tail 200  &lt;/P&gt;

&lt;P&gt;works fine.&lt;BR /&gt;
...&lt;BR /&gt;
|  eval tail_value=200&lt;BR /&gt;
|  tail tail_value&lt;/P&gt;

&lt;P&gt;throws this error:&lt;BR /&gt;
Error in 'tail' command: The number of results must be a positive number.&lt;/P&gt;

&lt;P&gt;I've used tokens as the tail argument but a simple variable is not recognized. For example:&lt;BR /&gt;
...&lt;BR /&gt;
| tail $token_from_dropdown$&lt;/P&gt;

&lt;P&gt;works.&lt;/P&gt;

&lt;P&gt;We've written a cumbersome work-around, but I know I'm missing the simple solution.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:21:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-a-variable-to-the-tail-command/m-p/147953#M41364</guid>
      <dc:creator>terryloar</dc:creator>
      <dc:date>2020-09-28T18:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pass a variable to the tail command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-a-variable-to-the-tail-command/m-p/147954#M41365</link>
      <description>&lt;P&gt;One possibility is to get the dynamic value via a subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | tail [ | stats count | eval search=10 | fields search ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That will effectively expand to a search that looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=_internal | tail ((10))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So in your case just come up with a subsearch that dynamically obtains your value.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2014 20:10:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-a-variable-to-the-tail-command/m-p/147954#M41365</guid>
      <dc:creator>jhupka</dc:creator>
      <dc:date>2014-12-10T20:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pass a variable to the tail command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-a-variable-to-the-tail-command/m-p/147955#M41366</link>
      <description>&lt;P&gt;Good, simple solution. Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Dec 2014 05:57:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-a-variable-to-the-tail-command/m-p/147955#M41366</guid>
      <dc:creator>terryloar</dc:creator>
      <dc:date>2014-12-11T05:57:17Z</dc:date>
    </item>
  </channel>
</rss>

