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!

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...