Splunk Search

How to combine search results in order to use Start Time and End Time from Event 1 in JMS Queue pending messages?

bojjas
Observer

Hello,

We are new to Splunk , learning and working customer requirments.

You are requested to help on merging these two queries in order to to use Start Time and End Time
from Event 1 in JMS Queue pending messages count > 0 after startTime and < 0 after endTime as Publisher and Subscribers are two seperate Java Applications in PCF:

Search - 1
==========
cf_org_name="####" cf_app_name="APP1" sourcetype="cf:logmessage" OR source = "XXXXX.EMS.STAT.QUEUES.SPLUNK.0.2021022312"
| fields msg.message msg.timestamp
| spath
| rename msg.message as message
| rename msg.timestamp as timestamp
| search message = "*Start of scheduler job cron:*" OR "*End of scheduler job executed in*"
| eval startMessage=case( match(message, "Start of scheduler job cron:"), message)
| eval endMessage=case(match(message, "End of scheduler job executed in"), message)
| rex field=startMessage "[^\#]+\#(?<schedulerJobStartTime>.*)"
| rex field=endMessage "[^\#]+\#(?<schedulerJobEndTime>.*)"
| stats max(schedulerJobStartTime) as latestJobStartTime max(schedulerJobEndTime) as latestJobEndTime
| eval latestJobStartTimeExpanded=strftime(latestJobStartTime/pow(10,3),"%Y-%m-%dT%H:%M:%S.%Q")
| eval latestJobEndTimeExpanded=strftime(latestJobEndTime/pow(10,3),"%Y-%m-%dT%H:%M:%S.%Q")
| eval duration=((latestJobEndTime - latestJobStartTime)/1000)/60/60
| spath output=pendingMessageCount path=queues{0}.pendingMessageCount
| spath output=msgTimeStampField path=key{0}.msgTimeStamp

Search - 2
==========
sourcetype=fedex:jms:queues| spath "queues.name" | search "queues.name"="XXXXPLAN.QNX"
| spath output=pendingMessageCount path=queues{0}.pendingMessageCount
| spath output=msgTimeStampField path=key{0}.msgTimeStamp
| search pendingMessageCount = "0"
| eval msgTimeStampFieldExpanded=strftime(msgTimeStampField/pow(10,3),"%Y-%m-%dT%H:%M:%S.%Q")
| stats min(msgTimeStampFieldExpanded) as msgTimeStampFieldExpandedMin max(msgTimeStampFieldExpanded) as msgTimeStampFieldExpandedMax

Regards,

Bojja

Labels (4)
Tags (1)
0 Karma
Get Updates on the Splunk Community!

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

 Ready to master Kubernetes and cloud monitoring like the pros? Join Splunk’s Growth Engineering team for an ...

Update Your SOAR Apps for Python 3.13: What Community Developers Need to Know

To Community SOAR App Developers - we're reaching out with an important update regarding Python 3.9's ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...