Refine your search:

I could then populate a dropdown list with indices :)

Somehow I could not get this done, would be cool if somebody could help me :)

I would prefer some in-splunk possibilities compared to file-parsing or CLI foo btw out of obv. reasons.

asked 26 Jan '12, 05:04

flo_cognosec's gravatar image

flo_cognosec
45118
accept rate: 0%


3 Answers:

The most efficient way to get accurate results is probably:

| eventcount summarize=false index=* | dedup index | fields index

Just searching for index=* could be inefficient and wrong, e.g., if one index contains billions of events in the last hour, but another's most recent data is back just before midnight, you would either miss out on the second index, or have to retrieve all billions of events just to discover it.

Update:

Corrected to include index=*. If you want to include internal indexes, you can use:

| eventcount summarize=false index=* index=_* | dedup index | fields index
link

answered 26 Jan '12, 07:04

gkanapathy's gravatar image

gkanapathy ♦
32.4k4827
accept rate: 41%

edited 27 Jan '12, 12:26

This does not give me a list of all available indices, just the ones I set up to be searched by default or am I missing something ?

(27 Jan '12, 00:14) flo_cognosec

Gkanapathy is quite right, my search would be rubbish! @flo_cognosec, the search you need is; | eventcount summarize=false index=* | dedup index | fields index

(27 Jan '12, 04:06) Drainy

Sorry, my mistake. You need to add 'index=*' as an argument to the summarize command, as draineh did.

(27 Jan '12, 07:42) gkanapathy ♦

This will not work. Such a search will only return events indexed locally, and therefore you have the potential to miss a bunch of indexes.

index=* | dedup index | fields index

run over all time

Would be better (in terms of getting all a complete list of indexes), but is not very efficient, it will only show indexes the person running the search has access to.

I don't believe Splunk has a reliable way to get a list of all current indexes through the web GUI (even the management section can be lacking in certain cases).

(27 Jan '12, 11:00) rtadams89
2

It is not correct that you will only see local indexes. the eventcount command will return all indexes that can be searched, local or remote distributed ones. But yes, it will only list ones that are accessible to the running user. It is true that Splunk's UI, API, and Management GUI does not provide a way to bypass security restrictions to allow people to list indexes they do not have access to.

(27 Jan '12, 12:32) gkanapathy ♦

I now hardcoded the index names in a StaticSelect for performance reasons ^^ Technically not pretty but efficient and solves my problem :)

(02 Feb '12, 04:17) flo_cognosec

Have you had a look at the UI Examples app? Splunk UI examples app for 4.1+ on Splunkbase

That has some good drop down search examples, so you could just build a drop down form dashboard where the drop down is populated with the results of something like index=* and choose the index fields to get the data.

link

answered 26 Jan '12, 05:19

Drainy's gravatar image

Drainy
8.2k617
accept rate: 24%

Thanks, sometimes you just overlook the obvious :/

(26 Jan '12, 05:53) flo_cognosec

is it possible to exclude some indexes of the list

link

answered 04 Oct '12, 07:23

manikdham's gravatar image

manikdham
514
accept rate: 0%

Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×452
×21
×1

Asked: 26 Jan '12, 05:04

Seen: 2,401 times

Last updated: 04 Oct '12, 07:23

Copyright © 2005-2012 Splunk Inc. All rights reserved.