<?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: map command to do stats stdev($field_name$) ... in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/map-command-to-do-stats-stdev-field-name/m-p/121675#M32762</link>
    <description>&lt;P&gt;How about this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=sampledata | stats stdev(f*)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 07 Apr 2014 12:53:02 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2014-04-07T12:53:02Z</dc:date>
    <item>
      <title>map command to do stats stdev($field_name$) ...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-command-to-do-stats-stdev-field-name/m-p/121673#M32760</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I am looking for a search that iterates all my fieldname start with f* and get the statistics value of each f and get the large table.&lt;/P&gt;

&lt;P&gt;sample data looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;timestamp,f1,f2,f3,f4,f5,f6,f7,f8,f9
2014/04/01 00:00:00,0,2,3,1,2,5,6,9,3
2014/04/01 00:00:01,1,0,0,1,2,3,10,1,2
...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;UL&gt;
&lt;LI&gt;there are 100+ f* fields.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Now I have the following search, which does not run successfully.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=sampledata
| head 1 
| table f* 
| transpose 
| table column 
| rename column as f_name 
| map maxsearches=1000 search="index=sampledata | stats stdev($f_name$) as stdev | eval f_name=$f_name$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get this error message&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Unable to run query 'index=sampledata | stats stdev(f1) as stdev | eval f_name=f1'.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am trying to get the result that looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;f_name, stdev
-------------
f1, 2
f2, 4
f3, 3
f4, 5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Anyone know how to use map command to do this? &lt;BR /&gt;
Or anyother way to perform?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2014 09:59:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-command-to-do-stats-stdev-field-name/m-p/121673#M32760</guid>
      <dc:creator>melonman</dc:creator>
      <dc:date>2014-04-07T09:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: map command to do stats stdev($field_name$) ...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-command-to-do-stats-stdev-field-name/m-p/121674#M32761</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
You have missed search in the map search query.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;....| map maxsearches=1000 search="search index=sampledata | stats stdev($f_name$) as stdev | eval f_name=$f_name$"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2014 10:32:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-command-to-do-stats-stdev-field-name/m-p/121674#M32761</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-04-07T10:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: map command to do stats stdev($field_name$) ...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-command-to-do-stats-stdev-field-name/m-p/121675#M32762</link>
      <description>&lt;P&gt;How about this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=sampledata | stats stdev(f*)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Apr 2014 12:53:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-command-to-do-stats-stdev-field-name/m-p/121675#M32762</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-07T12:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: map command to do stats stdev($field_name$) ...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-command-to-do-stats-stdev-field-name/m-p/121676#M32763</link>
      <description>&lt;P&gt;Thank you linu1988 for pointing out!&lt;/P&gt;

&lt;P&gt;I forgot "search"... also f_name's double quote with escape. Now my search looks like this. &lt;BR /&gt;
(now more stats inside the map command..)&lt;/P&gt;

&lt;P&gt;....| map maxsearches=1000 search="search index=sampledata | stats stdev($f_name$) as stdev median($f_name$) as median | eval f_name=\"$f_name$\""&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:19:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-command-to-do-stats-stdev-field-name/m-p/121676#M32763</guid>
      <dc:creator>melonman</dc:creator>
      <dc:date>2020-09-28T16:19:57Z</dc:date>
    </item>
  </channel>
</rss>

