Getting Data In

Can splunk search/monitor files that are not indexed?

MikeStorms
New Member

Is it possible to search/monitor non-indexed files? We create daily status files and we like to present the contents of the file on a dashboard. Basically, display the file contents, it is a non-indexed file, and a new one is created everyday.

Thanks!

0 Karma

jconger
Splunk Employee
Splunk Employee

If you just want to show the contents of the file on a dashboard, you could use jQuery ajax. Here is an example:

Simple XML dashboard:

<dashboard script="external_display.js">
  <label>Test External Content</label>
  <row>
    <panel>
      <html>
        <div id="my_content"></div>
      </html>
    </panel>
  </row>
</dashboard>

external_display.js:

require(["jquery", "splunkjs/mvc/simplexml/ready!"], function($) {
    $.ajax({
        url: 'http://localhost:8000/en-US/static/app/search/my_file.txt',
        success: function(data) {
            $('#my_content').html(data)
        }
    });
});

Note: external_display.js and my_file.txt reside in $SPLUNK_HOME/etc/apps/search/appserver/static. You could use any URL that is accessible by the Splunk web server (even file system paths).

0 Karma

xpac
SplunkTrust
SplunkTrust

Data has to either indexed or in a lookup file to be displayable. Lookups also have to be in CSV format.
The only other alternative would be to script a custom search command that can read content from disk when called.

Therefore you need to do either of this.
I'd advise to monitor a directory and put your files in that directory, and then read them from there.

0 Karma
Get Updates on the Splunk Community!

Build Scalable Security While Moving to Cloud - Guide From Clayton Homes

 Clayton Homes faced the increased challenge of strengthening their security posture as they went through ...

Mission Control | Explore the latest release of Splunk Mission Control (2.3)

We’re happy to announce the release of Mission Control 2.3 which includes several new and exciting features ...

Cloud Platform | Migrating your Splunk Cloud deployment to Python 3.7

Python 2.7, the last release of Python 2, reached End of Life back on January 1, 2020. As part of our larger ...