All Apps and Add-ons

db connect, trying to use value from database in earliest and latest

JonasLind
New Member

Hi,

I have a dbxquery and search "|dbxquery query="SELECT max(_time) as max_time_in_db FROM MY:TABLE" connection="my_connection"| eval start_time_temp =strptime(max_time_in_db, "%Y-%m-%d %H:%M:%S.%3N")|eval start_time = relative_time(start_time_temp,"+1d@d")| eval end_time = relative_time(start_time_temp,"+2d@d")
|eval test =strftime(start_time, "%m/%d/%Y:%H:%M:%S") |eval test2 =strftime(end_time, "%m/%d/%Y:%H:%M:%S")
|search index=my_index source IN (/my_source, my_source2) env=my_environment earliest=test latest=test2

Is it possible to use the values from dbxquery in earliest and latest? If it is, what do I do wrong
thanks for your help.

0 Karma
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...