Getting Data In

Splunk always one event behind

CaptSpify
Engager

I've got a scripted input that is giving me a bit of a headache. My index always be one line behind. For example:

My log looks like this:

2013-03-27      05:30:39 -  Event 1
2013-03-27      09:43:29 -  Event 2
2013-03-27      10:04:40 -  Event 3

But my index only shows 2 events.

2013-03-27      05:30:39 -  Event 1
2013-03-27      09:43:29 -  Event 2

If another line is added to the output:

2013-03-27      05:30:39 -  Event 1
2013-03-27      09:43:29 -  Event 2
2013-03-27      10:04:40 -  Event 3
2013-03-27      12:24:40 -  Event 4

Then my index shows 3 events:

2013-03-27      05:30:39 -  Event 1
2013-03-27      09:43:29 -  Event 2
2013-03-27      10:04:40 -  Event 3

It's like it's one-step behind all the time. I've got the script running in bash, and it shows the events correctly. I also don't think this is a multi-line issue, as each event is added as a separate item in the index correctly, it's not merging the lines.
I also added \n\r to the end of each result so it looked like:

2013-03-27      05:30:39 -  Event 1

2013-03-27      09:43:29 -  Event 2

2013-03-27      10:04:40 -  Event 3

But the index was still one line behind, only showing events 1 and 2 until event 4 came in.

Is there anything I can do in order to debug the input from the script to the index process?

0 Karma

CaptSpify
Engager

Sorry for the delay.

My interval is -1

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

Add SHOULD_LINEMERGE = false to your props. Splunk is waiting for the next event to see if it needs to merge it into the current one, so it can't index the current one until it sees that the next one contains a valid date.

CaptSpify
Engager

I've set the line-merge to false, and now it seems to be two events behind STDOUT. Color me confused.

Any other suggestions?

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

Or if you write to a file, a long enough (default 3 seconds) pause in new data written to a file will cause the file monitor to force an end to the event. There's no way in a scripted input to force the end (add a "_done" key) but you can do this in a modular input.

0 Karma

bmacias84
Champion

No, I would continue to use stdout. What is your scripted input interval also how busy is your indexer?

0 Karma

CaptSpify
Engager

I'm piping to stdout. Should it be going into a log-file?

0 Karma

bmacias84
Champion

Are piping to a log file and then reading the log file or our using the scripted input and piping stdout?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...