<?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: foreach indexer iostats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-come-this-doesn-t-work-given-indexers-csv-is-a-list-of/m-p/631932#M219495</link>
    <description>&lt;P&gt;That is not what foreach is designed for. It looks like you want to run a search using the value of each splunk_server in your lookup, so use a subsearch like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_introspection sourcetype=splunk_resource_usage component=IOStats [
  | inputlookup indexers.csv 
  | rename splunk_server as host 
]
| eval reads_ps = 'data.reads_ps' 
| eval writes_ps = 'data.writes_ps' &lt;/LI-CODE&gt;&lt;P&gt;I have left out the last two avg() statements as that is not how eval works - eval is to perform an action on a single event. If you want to create averages, use some form of stats command, e.g.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats avg(write_ps) as writes_ps avg(reads_ps) as reads_ps by host&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 22 Feb 2023 22:52:30 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2023-02-22T22:52:30Z</dc:date>
    <item>
      <title>How come this doesn't work given indexers.csv is a list of Splunk servers with role indexer?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-come-this-doesn-t-work-given-indexers-csv-is-a-list-of/m-p/631930#M219493</link>
      <description>&lt;P&gt;How come this doesn't work given indexers.csv is a list of Splunk servers with role Indexer?&lt;/P&gt;
&lt;P&gt;| inputlookup indexers.csv| rename splunk_server as Indxr| foreach Indxr [search index=_introspection sourcetype=splunk_resource_usage component=IOStats host=Indxr | eval reads_ps = 'data.reads_ps'| eval writes_ps = 'data.writes_ps' | eval writes_ps=avg(write_ps) | eval reads_ps=avg(reads_ps)]&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 23:05:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-come-this-doesn-t-work-given-indexers-csv-is-a-list-of/m-p/631930#M219493</guid>
      <dc:creator>albledsoe</dc:creator>
      <dc:date>2023-02-22T23:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: foreach indexer iostats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-come-this-doesn-t-work-given-indexers-csv-is-a-list-of/m-p/631932#M219495</link>
      <description>&lt;P&gt;That is not what foreach is designed for. It looks like you want to run a search using the value of each splunk_server in your lookup, so use a subsearch like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_introspection sourcetype=splunk_resource_usage component=IOStats [
  | inputlookup indexers.csv 
  | rename splunk_server as host 
]
| eval reads_ps = 'data.reads_ps' 
| eval writes_ps = 'data.writes_ps' &lt;/LI-CODE&gt;&lt;P&gt;I have left out the last two avg() statements as that is not how eval works - eval is to perform an action on a single event. If you want to create averages, use some form of stats command, e.g.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats avg(write_ps) as writes_ps avg(reads_ps) as reads_ps by host&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 Feb 2023 22:52:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-come-this-doesn-t-work-given-indexers-csv-is-a-list-of/m-p/631932#M219495</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-22T22:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: foreach indexer iostats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-come-this-doesn-t-work-given-indexers-csv-is-a-list-of/m-p/631937#M219497</link>
      <description>&lt;P&gt;Yep, that's it. It's been sometime since I wrote SPL.&amp;nbsp; I had been using the REST API in Bash and Javascript. But many don't want to run my scripts. So I am trying to convert to copy/paste SPL. Thanks for the quick tutorial.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 23:21:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-come-this-doesn-t-work-given-indexers-csv-is-a-list-of/m-p/631937#M219497</guid>
      <dc:creator>albledsoe</dc:creator>
      <dc:date>2023-02-22T23:21:15Z</dc:date>
    </item>
  </channel>
</rss>

