<?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 retrieve indexes from splunk.log in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681856#M113918</link>
    <description>&lt;P&gt;Hello splunk community,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have this query but I would also like to retrieve the index to which the sourcetype belongs&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=_internal splunk_server=* source=*splunkd.log* sourcetype=splunkd
(component=AggregatorMiningProcessor OR component=LineBreakingProcessor OR component=DateParserVerbose OR component=MetricSchemaProcessor OR component=MetricsProcessor) (log_level=WARN OR log_level=ERROR OR log_level=FATAL)
| rex field=event_message "\d*\|(?&amp;lt;st&amp;gt;[\w\d:-]*)\|\d*"
| eval data_sourcetype=coalesce(data_sourcetype, st)
| rename data_sourcetype as sourcetype
| table sourcetype event_message component thread_name _time _raw
| stats first(event_message) as event_message by sourcetype component&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;any ideas ?&lt;BR /&gt;thx in advance&lt;/P&gt;</description>
    <pubDate>Mon, 25 Mar 2024 14:06:34 GMT</pubDate>
    <dc:creator>tay</dc:creator>
    <dc:date>2024-03-25T14:06:34Z</dc:date>
    <item>
      <title>retrieve indexes from splunk.log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681856#M113918</link>
      <description>&lt;P&gt;Hello splunk community,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have this query but I would also like to retrieve the index to which the sourcetype belongs&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=_internal splunk_server=* source=*splunkd.log* sourcetype=splunkd
(component=AggregatorMiningProcessor OR component=LineBreakingProcessor OR component=DateParserVerbose OR component=MetricSchemaProcessor OR component=MetricsProcessor) (log_level=WARN OR log_level=ERROR OR log_level=FATAL)
| rex field=event_message "\d*\|(?&amp;lt;st&amp;gt;[\w\d:-]*)\|\d*"
| eval data_sourcetype=coalesce(data_sourcetype, st)
| rename data_sourcetype as sourcetype
| table sourcetype event_message component thread_name _time _raw
| stats first(event_message) as event_message by sourcetype component&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;any ideas ?&lt;BR /&gt;thx in advance&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 14:06:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681856#M113918</guid>
      <dc:creator>tay</dc:creator>
      <dc:date>2024-03-25T14:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve indexes from splunk.log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681860#M113920</link>
      <description>&lt;P&gt;You can't retrieve the index from the log if it isn't there, which is the case for these events.&amp;nbsp; You'll have to search for the index by sourcetype.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count where index=* sourcetype=data_sourcetype
| fields - count&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 25 Mar 2024 13:48:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681860#M113920</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-03-25T13:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve indexes from splunk.log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681861#M113921</link>
      <description>&lt;DIV class=""&gt;&lt;DIV&gt;This is precisely my problem, I have to start from this command and therefore retrieve the index elsewhere... but then what happens if the indexes have sourcetype names in common?&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 25 Mar 2024 13:52:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681861#M113921</guid>
      <dc:creator>tay</dc:creator>
      <dc:date>2024-03-25T13:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve indexes from splunk.log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681863#M113922</link>
      <description>&lt;P&gt;Nothing "happens".&amp;nbsp; It's legitimate for a sourcetype to be present in more than one index.&amp;nbsp; It may complicate your query, though.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 13:57:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681863#M113922</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-03-25T13:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve indexes from splunk.log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681865#M113923</link>
      <description>&lt;P&gt;so if I do a "join" with your query, the correct index will be associated with the sourcetype?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 14:16:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681865#M113923</guid>
      <dc:creator>tay</dc:creator>
      <dc:date>2024-03-25T14:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve indexes from splunk.log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681883#M113926</link>
      <description>&lt;P&gt;I try to avoid &lt;FONT face="courier new,courier"&gt;join&lt;/FONT&gt; where possible, but I can't make this query work without it.&amp;nbsp; See if this helps you.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal splunk_server=* source=*splunkd.log* sourcetype=splunkd
(component=AggregatorMiningProcessor OR component=LineBreakingProcessor OR component=DateParserVerbose OR component=MetricSchemaProcessor OR component=MetricsProcessor) (log_level=WARN OR log_level=ERROR OR log_level=FATAL)
| rex field=event_message "\d*\|(?&amp;lt;st&amp;gt;[\w\d:-]*)\|\d*"
| eval data_sourcetype=coalesce(data_sourcetype, st)
| rename data_sourcetype as sourcetype
| fields sourcetype event_message component
| join sourcetype [| tstats count where index=* by sourcetype, index 
  | fields - count ]
| table sourcetype component event_message index&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 16:59:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681883#M113926</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-03-25T16:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve indexes from splunk.log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681906#M113927</link>
      <description>&lt;P&gt;Probably append with some stats values() would do the trick similarily to join.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 20:43:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681906#M113927</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-03-25T20:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve indexes from splunk.log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681963#M113937</link>
      <description>&lt;P&gt;Thanks, even if the query consumes a lot, but it works&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 08:07:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/retrieve-indexes-from-splunk-log/m-p/681963#M113937</guid>
      <dc:creator>tay</dc:creator>
      <dc:date>2024-03-26T08:07:23Z</dc:date>
    </item>
  </channel>
</rss>

