Getting Data In
Highlighted

Splunk always one event behind

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
Highlighted

Re: Splunk always one event behind

Champion

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

0 Karma
Highlighted

Re: Splunk always one event behind

Engager

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

0 Karma
Highlighted

Re: Splunk always one event behind

Champion

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

0 Karma
Highlighted

Re: Splunk always one event behind

Legend

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.

Highlighted

Re: Splunk always one event behind

Legend

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
Highlighted

Re: Splunk always one event behind

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
Highlighted

Re: Splunk always one event behind

Engager

Sorry for the delay.

My interval is -1

0 Karma
Speak Up for Splunk Careers!

We want to better understand the impact Splunk experience and expertise has has on individuals' careers, and help highlight the growing demand for Splunk skills.