Getting Data In

How to monitor change in scripted input?

ben_leung
Builder

How do you make sure to send logs from a scripted input only when the output is changed?

Lets say the script is doing an "ls" on the file system and runs every minute. I do not want an index to get filled with the same events just with a different time stamp.

How do you make sure that Splunk only forwards data whenever the scripts output is different than the previous output?

Tags (2)
0 Karma
1 Solution

skawasaki_splun
Splunk Employee
Splunk Employee

If you already wrote a script then at the end of the script take the result of "ls" and write to a file. In the beginning of the script, check that file and only output to STDOUT if there is a difference.

In other words, Splunk can't do this "difference" functionality. Your script will have to do this.

View solution in original post

skawasaki_splun
Splunk Employee
Splunk Employee

If you already wrote a script then at the end of the script take the result of "ls" and write to a file. In the beginning of the script, check that file and only output to STDOUT if there is a difference.

In other words, Splunk can't do this "difference" functionality. Your script will have to do this.

Get Updates on the Splunk Community!

Updated Data Type Articles, Anniversary Celebrations, and More on Splunk Lantern

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

A Prelude to .conf25: Your Guide to Splunk University

Heading to Boston this September for .conf25? Get a jumpstart by arriving a few days early for Splunk ...

4 Ways the Splunk Community Helps You Prepare for .conf25

.conf25 is right around the corner, and whether you’re a first-time attendee or a seasoned Splunker, the ...