Getting Data In

How do you ingest events of a particular time period from a file in Splunk?

kasturea
Explorer

I have a log file of about 400 MB in size. I don't want to ingest it completely. I just want a few events from a particular time period.
For Example: I just want to ingest events from 11am to 12pm, rest I don't want to collect in Splunk.

Is it possible to do it ? If yes, then what could be the best practice to do so ?

Thanks in Advance!

Tags (1)
0 Karma

renjith_nair
Legend

@kasturea,

Best practices would be to avoid writing events to files that you don't want to collect or separate into different files based on the type or usability and then forward only those files to Splunk which are interesting for you.

If both of these options are not applicable for you, then the next solution would be filtering the events before they get into the Splunk indexes. The Splunk forwarder forwards all events, whatever it gets, without any filter. So we need to have an intermediate forwarder(heavy forwarder) to do the filtering before the event reaches the indexer or do the filtering at indexer side before it gets indexed.

Depending on your Splunk deployment, you could do it on either side i.e. HF or indexer.

Here is a documentation which explains how to use the filtering Discard specific events and keep the rest OR Keep specific events and discard the rest based on the amount of data you discard or accept. In your case, you have to do the filtering on time. i.e. send only data from 11am to 12pm. Refer to this example from @MuS which explains How to index certain logs only during a certain time range

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

inventsekar
SplunkTrust
SplunkTrust

the data is local on indexer or remote(on forwarder)
You can use "scripted inputs"... using a shell script or python, you can fetch the data and send it to splunk.

https://docs.splunk.com/Documentation/Splunk/7.0.3/Data/Getdatafromscriptedinputs

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...