Splunk Search

calculate min and max time of event

sarit_s
Communicator

hello
im trying to calculate min and max time of event (the time when the event started and when its ended)
when im adding my calculation to the query im loosing the results of the rest of the query and getting only the result of the time calculation...
what am i missing ?

index=prod eventtype="csm-messages-dhcpd-lpf-eth0-listening" OR eventtype="csm-messages-dhcpd-lpf-eth0-sending" OR eventtype="csm-messages-dhcpd-send-socket-fallback-net" OR eventtype="csm-messages-dhcpd-write-zero-leases" OR eventtype="csm-messages-dhcpd-eth1-nosubnet-declared"

| transaction maxpause=2s maxspan=1s maxevents=5
| stats first(_time) as min_time, last(_time) as max_time
| table _time,eventcount, eventtype, tail_id, kafka_uuid,min_time,max_time

| foreach eventtype
     [eval flag_eventtype=if(eventcount!=5,"no", "yes")]
0 Karma

to4kawa
Ultra Champion

transaction has only one _time

0 Karma

sarit_s
Communicator

so i can i do it differently ?

0 Karma

to4kawa
Ultra Champion

Why don't you try using a command other than transaction ?
or extract _time by using rex again.

0 Karma

sarit_s
Communicator

im open to try, i just don't know what and how 🙂

0 Karma

to4kawa
Ultra Champion
0 Karma

sarit_s
Communicator

it looks like using transaction is the right way.. so how can i use rex to extract _time ?

0 Karma

to4kawa
Ultra Champion

I don't know, check your log.

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...