Knowledge Management

How to delete a log by splunk api

carineconstanti
New Member

Hi, everubody

I monitor some files and sometime the data in these files are updated

I need to delete wrong data on Splunk by API.

How I can delete only a log that is wrong and that has been indexed on Splunk by Api command ?

Thanks

Tags (1)
0 Karma

micahkemp
Champion

If you can suffuciently craft a search that finds only the event(s) you want to delete, you can pipe the results of that search to the delete command.

Note that none of the default roles have the can_delete capability. You would need to either add this capability to a role temporarily, or create a new user/role just for this purpose.

0 Karma

felipesewaybric
Contributor

https://answers.splunk.com/answers/289083/how-to-delete-event-data-from-an-indexer-using-the.html

bmacias84: The api does not provide facilities to clean the eventdata as Splunk daemon needs to be stopped. You are better off using remote ssh command or powershell command to run the shell commands. You can use the "|delete" command to mark the data as unsearchable
via the api by create a search job, but that does not remove the data.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...