Knowledge Management

how to delete old date from splunk

huabanyu8411
New Member

how to delete old date from splunk。

Tags (1)
0 Karma
1 Solution

BobM
Builder

I guess you mean how do you delete old data from splunk. There are three methods of achieving this.

  1. To delete EVERYTHING in an index, you need to use the clean command from the command line.

    splunk clean eventdata -index <indexname>

    see Remove indexed data from Splunk for more detail

  2. To delete specific events, you need to add the "can_delete" roll to your account, search for the data to delete and then pipe to the delete command. For example from the search bar of your browser to delete < mydata> older than a year :-

    index=main sourcetype=<mydata> latest=-1y | delete

    see Delete command for more detail

  3. To automatically delete data in an index older than an age, you need to set the frozenTimePeriodInSecs attribute in indexes.conf. eg. to set the default to delete data after 1 year use :-

    [default]
    frozenTimePeriodInSecs = 31536000

    see Set a retirement and archiving policy for more detail

Bob

View solution in original post

BobM
Builder

I guess you mean how do you delete old data from splunk. There are three methods of achieving this.

  1. To delete EVERYTHING in an index, you need to use the clean command from the command line.

    splunk clean eventdata -index <indexname>

    see Remove indexed data from Splunk for more detail

  2. To delete specific events, you need to add the "can_delete" roll to your account, search for the data to delete and then pipe to the delete command. For example from the search bar of your browser to delete < mydata> older than a year :-

    index=main sourcetype=<mydata> latest=-1y | delete

    see Delete command for more detail

  3. To automatically delete data in an index older than an age, you need to set the frozenTimePeriodInSecs attribute in indexes.conf. eg. to set the default to delete data after 1 year use :-

    [default]
    frozenTimePeriodInSecs = 31536000

    see Set a retirement and archiving policy for more detail

Bob

chutz
Engager
0 Karma

rusty009
Path Finder

as an aside, the delete command doesn't actually delete the logs, it jut makes them unsearchable. So if you're looking to save some disk space this might not be the best method to use.

0 Karma

Ayn
Legend

Provide more details for your question, please.

Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...