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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...