Splunk Search

How to Identify a repeated set up messages [for looping process]?

Mick_OBrien
Path Finder

We have a job that occasionally loops around the same code spewing out same set of messages [2 different messages from same job] - is it possible to identify processes where the last 2 messages match the previous 2 messages...

 

.

.

.

message1

message2

message1 <-- starts repeating/looping here

message2

message1

message2

message1

message2

.

.

Any help appreciated.

 

Mick

Labels (3)
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It is possible but it depends on your messages.

Are the messages from the process unique apart from when they are repeated?

Can you correlate messages from the same instance of the process without confusing them with messages from another instance of the process?

Are the loops any bigger or smaller than two messages?

What do you need to be kept in the report, e.g. all messages, just the process id?, just the time of the first duplicated message, just the fact that a process has looped?

0 Karma

Mick_OBrien
Path Finder

The messages are valid but once starting to loop indicates issue with process - messages can be from different processes but I am only interested in messages repeating on same process.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| eventstats count as repeats by process message
| where repeats > 1
0 Karma

Mick_OBrien
Path Finder

Sorry - but how does this pick up a set of messages on the same process repeating?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| makeresults format=csv data="process,message
A,message 0
B,message 0
A,message 1
B,message 1
A,message 2
B,message 2
A,message 1
B,message 3
A,message 2
A,message 1
A,message 2"
| eventstats count as repeats by process message
| where repeats > 1

As you can see, only messages that are repeated are shown

0 Karma

Mick_OBrien
Path Finder

I ran from search prompt bar but nothing was returned for result set - is there a specific way to use 'makeresults' syntax?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Which version of Splunk are you using (the makeresults command changed in version 9).

The makeresults is only to create some example data to show you that the commands work.

PickleRick
SplunkTrust
SplunkTrust

Ha! Good to know about the makeresults. I didn't know that.

0 Karma

Mick_OBrien
Path Finder

Splunk Enterprise

Version:8.2.7.1

0 Karma

Mick_OBrien
Path Finder

See below - no output from search string...

makeresults screenshot.PNG

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try this pre-9 syntax

| makeresults
| eval _raw="process,message
A,message 0
B,message 0
A,message 1
B,message 1
A,message 2
B,message 2
A,message 1
B,message 3
A,message 2
A,message 1
A,message 2"
| multikv forceheader=1
| table process,message
| eventstats count as repeats by process message
| where repeats > 1

Mick_OBrien
Path Finder

Thanks - the pre-9 syntax works but multiple instances of the same repeated log are displayed....

makeresults screenshot - pre-9 syntax.PNG

Is there a way to limit to one set of logs?

0 Karma
Get Updates on the Splunk Community!

Combine Multiline Logs into a Single Event with SOCK - a Guide for Advanced Users

This article is the continuation of the “Combine multiline logs into a single event with SOCK - a step-by-step ...

Everything Community at .conf24!

You may have seen mention of the .conf Community Zone 'round these parts and found yourself wondering what ...

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...