<?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: collect index=&amp;quot;based on values&amp;quot; in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473594#M4204</link>
    <description>&lt;P&gt;Hi fklink,&lt;BR /&gt;
why do you need to use only one search?&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Fri, 06 Sep 2019 14:17:13 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2019-09-06T14:17:13Z</dc:date>
    <item>
      <title>How to collect index="based on values"</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473593#M4203</link>
      <description>&lt;P&gt;Hi everybody,&lt;/P&gt;
&lt;P&gt;is it possible to create several summary index within one search?&lt;/P&gt;
&lt;P&gt;Example:&lt;BR /&gt;"&lt;STRONG&gt;Index A&lt;/STRONG&gt;" has a &lt;STRONG&gt;field&lt;/STRONG&gt; "&lt;STRONG&gt;OS&lt;/STRONG&gt;" with &lt;STRONG&gt;values&lt;/STRONG&gt; "&lt;STRONG&gt;Windows&lt;/STRONG&gt;", "&lt;STRONG&gt;Linux&lt;/STRONG&gt;"...&lt;/P&gt;
&lt;P&gt;Is there a way to tell splunk to loop something like: &lt;CODE&gt;index=A | collect index="OS"&lt;/CODE&gt; (where OS is the field-value)&lt;/P&gt;
&lt;P&gt;So that each result based on field OS will be stored in (allready created) index "Windows", "Linux", ....&lt;/P&gt;
&lt;P&gt;Many thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 17:34:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473593#M4203</guid>
      <dc:creator>fklink</dc:creator>
      <dc:date>2022-06-13T17:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: collect index="based on values"</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473594#M4204</link>
      <description>&lt;P&gt;Hi fklink,&lt;BR /&gt;
why do you need to use only one search?&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 14:17:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473594#M4204</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-09-06T14:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: collect index="based on values"</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473595#M4205</link>
      <description>&lt;P&gt;Hi Guiseppe,&lt;/P&gt;

&lt;P&gt;the values &lt;STRONG&gt;Windows&lt;/STRONG&gt; and &lt;STRONG&gt;Linux&lt;/STRONG&gt; are exemplary. &lt;/P&gt;

&lt;P&gt;In fact, there are about 150 different values that vary.&lt;/P&gt;

&lt;P&gt;My goal is to use one query to fill the 150 different indexes (automatically)&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 14:27:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473595#M4205</guid>
      <dc:creator>fklink</dc:creator>
      <dc:date>2019-09-06T14:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: collect index="based on values"</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473596#M4206</link>
      <description>&lt;P&gt;Hi fklink,&lt;BR /&gt;
are you sure about this?&lt;BR /&gt;
an elevated quantity of indexes isn't a best practice!&lt;BR /&gt;
You should analyze your needs and define the correct number of indexes thinking to the main reason to have different indexes:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;different retention periods,&lt;/LI&gt;
&lt;LI&gt;different access rights.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;In addition you can take in consideration also the quantity of logs ingested (e.g. it isn't a good practice to have in the same index logs from large flows with logs from little flows).&lt;BR /&gt;
But anyway 150 indexes are very many indexes!&lt;BR /&gt;
Don't think to indexes as DB tables, Splunk is different!&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 14:42:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473596#M4206</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-09-06T14:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: collect index="based on values"</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473597#M4207</link>
      <description>&lt;P&gt;Here's how I've written that before&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search that generates events with some field rectype

| rename COMMENT as "send foo to index foo"
| appendpipe [ 
    | where rectype="foo" 
    | collect index="foo" testmode=f other parameters
    | where false()
    ]

| rename COMMENT as "send bar to index bar"
 | appendpipe [ 
    | where rectype="bar" 
    | collect index="bar" testmode=f other parameters
    | where false()
    ]

| rename COMMENT as "repeat for each destination index"


| rename COMMENT as "This last one doesn't go to an index but it lets you see as the search results what would have done so for all types"
| collect index="goingnowhere" testmode=t other parameters 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Sep 2019 20:51:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473597#M4207</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2019-09-06T20:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: collect index="based on values"</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473598#M4208</link>
      <description>&lt;P&gt;Hi DalJeanis,&lt;/P&gt;

&lt;P&gt;many thanks for your help. &lt;/P&gt;

&lt;P&gt;Since the values within &lt;STRONG&gt;"rectype"&lt;/STRONG&gt; can differ, I'm looking for a solution that fills the field variably.&lt;/P&gt;

&lt;P&gt;someting like: &lt;CODE&gt;| collect index="$value_of_rectype$"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Sep 2019 10:16:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473598#M4208</guid>
      <dc:creator>fklink</dc:creator>
      <dc:date>2019-09-07T10:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: collect index="based on values"</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473599#M4209</link>
      <description>&lt;P&gt;Hi Guiseppe,&lt;/P&gt;

&lt;P&gt;thanks for your help.&lt;/P&gt;

&lt;P&gt;Because of permissions i have to create 150 index &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Maybe i will find an other solution.....&lt;/P&gt;</description>
      <pubDate>Sat, 07 Sep 2019 10:20:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473599#M4209</guid>
      <dc:creator>fklink</dc:creator>
      <dc:date>2019-09-07T10:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: collect index="based on values"</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473600#M4210</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search that generates events with some field rectype
| _SI_Name_{index} = "IgnoreMe"
| foreach _SI_Name_* [
| appendpipe [ 
   where rectype="$MATCHSTR$"
| collect index="$MATCHSTR$" testmode=f other parameters
| where false()
] ]
| rename COMMENT as "Anything left at this point did not go into an index, which may be an error"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Sep 2019 14:22:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/473600#M4210</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-09-09T14:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: collect index="based on values"</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/601429#M8863</link>
      <description>&lt;P&gt;The following is a&amp;nbsp;subset of a larger solution I came up with to anonymize and re-index some previously ingested events while maintaining their original index, sourcetype, source, host, and _time fields.&lt;/P&gt;&lt;P&gt;Create a set of index-time props and transforms that:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Separately assign each event to their own index.&lt;/LI&gt;&lt;LI&gt;Restore default summary sourcetype of "stash".&lt;/LI&gt;&lt;LI&gt;Remove the pre-pended index name from each event.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Then&amp;nbsp;pre-pend a target index name to each event record before calling |collect with a sourcetype matching the stanza from your props.conf (and which is reverted back to "stash" to not count against license).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#Index time props.conf
[per_event_summary_index]
TRANSFORMS-set_summary_index = reset_index, reset_stash_sourcetype, remove_prepended_field

#Index time transforms.conf
[reset_index]
DEST_KEY = _MetaData:Index
REGEX = (.*?),
FORMAT = $1
[reset_stash_sourcetype]
DEST_KEY = MetaData:Sourcetype
FORMAT = stash
[remove_prepended_field]
INGEST_EVAL = _raw=replace(_raw,".*?,","")

```Send events to separate summary indexes based on OS.```
index=A 
|eval _raw=OS.","._raw 
|collect sourcetype=per_event_summary_index&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Three years too late for your use but maybe it will help others.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jun 2022 18:33:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-collect-index-quot-based-on-values-quot/m-p/601429#M8863</guid>
      <dc:creator>scombs</dc:creator>
      <dc:date>2022-06-11T18:33:17Z</dc:date>
    </item>
  </channel>
</rss>

