All Apps and Add-ons

Regex in Dashboard is taking too much time

nilaksh92
Path Finder

Hi Everyone

I have multiple rex queries in my dashboard which are taking much time.

Is there any way, to take out the rex from my dashboard.

Query what I am using is

|rex field=a "(?<a_hour>[^:]+)?:(?<a_min>\d+)?:(?<a_sec>\d+)"
| eval a_seconds =(a_hour*3600)+(a_min * 60) + a_sec

Like this I have multiple queries for multiple fields.

Please help me out.

Thanks
Nikks

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

Give this a try (adding HH portion if not present, then using convert)

....| eval a=if(len(a)!=8,"00".a,a)
| convert dur2sec(a) as a_seconds

View solution in original post

somesoni2
Revered Legend

Give this a try (adding HH portion if not present, then using convert)

....| eval a=if(len(a)!=8,"00".a,a)
| convert dur2sec(a) as a_seconds

nilaksh92
Path Finder

Thanks somesoni.

It worked.

Can we create a calculated field for the

| eval a=if(len(a)!=8,"00".a,a)
 | convert dur2sec(a) as a_seconds

Thanks
Nikks

0 Karma

somesoni2
Revered Legend

Can we have some sample data please, for field a?

cmerriman
Super Champion

i agree, can we have a few samples of this? if you timestamp is in :MM:HH, the regex above doesn't seem likely to work properly.

0 Karma

nilaksh92
Path Finder

Hi

it use to get data like
:00:00
12:34:78
:34:56

0 Karma

cmerriman
Super Champion

your field a is HH:MM:SS?
you could just do a |convert dur2sec(a) as a_seconds

https://docs.splunk.com/Documentation/SplunkCloud/6.6.0/SearchReference/Convert

0 Karma

nilaksh92
Path Finder

Hi

it is in :MM:HH format.

I tried |convert dur2sec(a) as a_seconds but it didn't work with above format.

Is there any other way?

Thanks
Nikks

0 Karma

cmerriman
Super Champion

can you try to add timeformat=":%M:%H"

0 Karma

nilaksh92
Path Finder

Can you tell me the way how to add this?

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...