Splunk Search

How to filter the events

gladiatorankit
Explorer

When input a value in a search box it shows all the events and all the values are displayed which are not in the file anymore. How to restrict events to show the latest results in a txt file? Or should I reindex the file?

Tags (1)
0 Karma
1 Solution

yannK
Splunk Employee
Splunk Employee

"which are not in the file anymore"
Yes, this is what Splunk is about, a timebase search tool for events with a timestamp.
It doesn't know anything about what is in the log file now.
If you want to see the latest values, restrict the search time range.

if your log file is always the same format with fields (like a configuration file), and is erased and replaced by the new version, you could use the "dedup" command to retrieve the latest values for a given field.

View solution in original post

yannK
Splunk Employee
Splunk Employee

"which are not in the file anymore"
Yes, this is what Splunk is about, a timebase search tool for events with a timestamp.
It doesn't know anything about what is in the log file now.
If you want to see the latest values, restrict the search time range.

if your log file is always the same format with fields (like a configuration file), and is erased and replaced by the new version, you could use the "dedup" command to retrieve the latest values for a given field.

gladiatorankit
Explorer

Thanks alot for sharing the right command.

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...