Splunk Dev

Tracking if file size is 0 bytes 30 seconds after creation

suhanrs
New Member

How to track if file size is 0 bytes 30 seconds after creation. Can anyone help me with this?

Thank you very much.

Tags (1)
0 Karma

skoelpin
SplunkTrust
SplunkTrust

This can be done with some conditional logic.

This assumes you have a filed called Creation_time which is in seconds AND have a field called bytes

| eval Creation_time_plus_thirty='Creation_time'+30
| eval time_after_creation=if(_time>'Creation_time_plus_thirty',1,0)
| eval ALERT=if(time_after_creation=1 AND bytes=0,"ALERT","GOOD")
| search ALERT="ALERT"
0 Karma

suhanrs
New Member

Thank you for your help.
But what search command do I have to use to get the file size if there is no field called bytes?

0 Karma

skoelpin
SplunkTrust
SplunkTrust

How are you currently calculating bytes? Do you have a GB, MB, or KB field?

0 Karma

suhanrs
New Member

No, there is no any field called bytes but I need to monitor the file size of a particular path.

I have tried with fschange stanza in inputs but it throws an error;
FSChangeMonitor - Monitoring file or directory that doesn't exist at startup time

How can I solve this?

0 Karma

skoelpin
SplunkTrust
SplunkTrust

Then how do you plan on doing this if you aren't monitoring the byte size? You should strongly consider these details before asking questions on here and wasting time

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 at Splunk .conf24 ...

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 ...