Splunk Search

How to monitor a log file that updates the same line?

leon24
Explorer

Hi all,

I have a log file that briefly logs file in this pattern.

For e.g.
Available 12-01-2014 03:03:44

So if there is no change in the status, the timestamp gets updated every minute (it doesn't creates a new line)

The previous sample might be changed to the following.

For e.g.
Available 12-01-2014 03:04:44

If there is a change in the status, a new line will be created (and if no change in status, only the timestamp gets updated).

For e.g.
Available 12-01-2014 03:04:44
Unavailable 12-01-2014 03:04:50

I am able to create dashboards for logs that appends new line at the end of file, however, I'm unable to monitor the above mentioned logs that does not append new lines but instead updates the existing line.

My search string is as follow (it works for logs that appends new lines)

index="index_name" | stats latest(status), latest(availability_date), latest (availability_time)

The dashboard always shows the latest line at first (which is what I want), however when the dashboard gets updated again, it will automatically show the earliest result in the log file instead.

Anybody able to help?

Tags (1)
0 Karma

dwaddle
SplunkTrust
SplunkTrust

This is less solution and more personal opinion. If you have control of this application's source code - change it to do something more sane 🙂

0 Karma

leon24
Explorer

Hi dwaddle,

Unfortunately I do not have control of the application's source code, apparently it is SAP log files and the SAP application belongs to another team. 😞

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

You would need to use the CHECK_METHOD setting in props.conf. If you set it to entire_md5 or modtime, changes anywhere in the file will index the whole file.

leon24
Explorer

My dashboard search string is as follow:

index="my_index" sourcetype="sap_availability" | stats latest(sap_availability_status) as "Status", latest(sap_availability_date) as "Date" by host | eval host=lower(host) | sort host ASC | rename host as "Host"

0 Karma

leon24
Explorer

Hi gkanapathy and all,

I've made the changes in the server which has the forwarder to the file ../etc/system/local/props.conf.

This is the new line that I've created.

[]
CHECK_METHOD = modtime

In my case, it is

[sap_availability]
CHECK_METHOD = modtime

I'm still seeing the earliest entry in the dashboard. Am I configuring the wrong file or using the wrong format?

Prior to this change, my dashboard actually loads with the latest event and when the dashboard refreshes, it will load back earliest event. Further refreshes also reflects to the earliest event.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...