Getting Data In

How to combine Data from a lookup with a query to Pull latest values?

amedina
Engager

Hello,

Background story:
I have a data set that is being ingested by Splunk by the HTTP event collector, when this connector was added to Splunk, the connector started ingesting current logs from the appliance and no historical logs prior to that day it was connected.

Fast forward, in order to account for those missing logs a lookup was created. The dataset contains "Issue IDs" with its corresponding "status"

What I am trying to do is, combine the data from the lookup with the index to look pull back the latest value for "status" for the "Issue ID".
However, when the query is ran, the value from the lookup always trumps the recent data from the index, even though the lookup is 1 week older then the log comparing it.

Without the lookup, the query works fine, it is able to pull the latest values for "status".


This is how I have formulated the query:

|inputlookup OpenIssues
|fields "Issue ID",Status,Severity
|rename Status AS issue.status
|rename "Issue ID" as issue.id
|rename Severity as issue.severity
|append [search index="dataset A" sourcetype=_json
|fields  issue.id issue.status
|stats latest(issue.status)

richgalloway
SplunkTrust
SplunkTrust

If newer events have to trump older events then the lookup file must contain timestamps.  After the indexed data is appended to the lookup data, sort by timestamp then take the first (newest) event.

|inputlookup OpenIssues
|fields "Issue ID",Status,Severity, timestamp
|rename Status AS issue.status
|rename "Issue ID" as issue.id
|rename Severity as issue.severity
|append [search index="dataset A" sourcetype=_json
|fields  issue.id issue.status timestamp
```Put the newest events first```
|sort 0 - timestamp
|stats first(issue.status)
---
If this reply helps you, Karma would be appreciated.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...