Getting Data In

Is there a way to reverse the action of "splunk add oneshot" on a specific input file?

sissa
New Member

Our Splunk forwarder has missed one file (1 hour worth of logs) for some reason, so I used oneshot to load the missing file:

/opt/splunkforwarder/bin/splunk add oneshot <log_file> 1 -sourcetype <spourcetype1> -index <index1> -host <host1> -auth user:pwd

Unfortunately, I ran the above command twice, and we ended up with double the records.

Is there a way to remove these specific records without compromising the entire index?

0 Karma
1 Solution

esix_splunk
Splunk Employee
Splunk Employee

You can use the delete command from search.. ( you do need to add this ability to your role.)

index=whatever sourcetype=oneshott'dsourcetypename | delete

Of course, change the index name and sourcetype to match what you added it as. And note, this will delete all the data you one-shotted. So this assumes that the sourcetype is unique for the oneshot data. If you added this to an existing sourcetype, then you would need to adjust this search to the source you added it as.

Also, this deletes all events that were added. You can either modify the search to try and delete only a single set of the duplicates, or delete them all, and re-oneshot the data.

View solution in original post

0 Karma

esix_splunk
Splunk Employee
Splunk Employee

You can use the delete command from search.. ( you do need to add this ability to your role.)

index=whatever sourcetype=oneshott'dsourcetypename | delete

Of course, change the index name and sourcetype to match what you added it as. And note, this will delete all the data you one-shotted. So this assumes that the sourcetype is unique for the oneshot data. If you added this to an existing sourcetype, then you would need to adjust this search to the source you added it as.

Also, this deletes all events that were added. You can either modify the search to try and delete only a single set of the duplicates, or delete them all, and re-oneshot the data.

0 Karma

sissa
New Member

Thanks for the prompt response, much appreciated, unfortunately I couldn't do it myself, I need to wait for the administrator to either grant me access to delete or do it on my behalf.
cheers

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...