Splunk Search

Creating a search to take id values from one day, and search for them in the following days

anthony_copus
Explorer

Hi,

I currently need to create a search which takes the id values from a new_user event on 1 day, then searches for if they exist on the following days. The output should be something like:

New Users: 1000
New Users Returning in the 2 days following: 200

I can't figure out how to form the search for this, but in effect I guess it should have this sort of logic:
[index=new_users | fields id] index="other_events" earliest=(selected time + 24h) | stats dc(id) AS count

Can anyone suggest the best query to achieve this?

Thanks,
Anthony

0 Karma

acharlieh
Influencer

I need to play with things on something other than my phone to get the syntax right, but you probably could have 2 subsearches to define earliest and latest for the parent search. You'd likely use addinfo to help drive based on the selected timeframe. Possibly [|noop|stats count|addinfo| eval latest=relative_time(info_max_time,"+2d") | fields latest] [|noop|stats count|addinfo|rename info_max_time AS earliest|fields earliest]

0 Karma
Get Updates on the Splunk Community!

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Your Voice Matters! Help Us Shape the New Splunk Lantern Experience

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Building Momentum: Splunk Developer Program at .conf25

At Splunk, developers are at the heart of innovation. That’s why this year at .conf25, we officially launched ...