Splunk Search

how to convert days,minutes,hours and seconds to just seconds format to obtain the visualization?

pavanae
Builder

I have a simple lookup query as follows :-

| inputlookup ABC.csv

which gives the result as follows :-

alt text

Which doesn't give me any visualization. Now how can I get a "Line Chart" visualization with 3 line patterns like "time-to-close", "time-to-discover" and "time-to-respond"

I assume the current time format for all the 3 columns should be converted to a unique value either by seconds or by minutes inorder to get any visualization like "1 d,0 h, 0 m and 0 s" as "86400s" but I'm not sure how to get the eval logic for that.

Any help would be great.

0 Karma
1 Solution

renjith_nair
Legend

Try this and if it works for you, then convert all fields similar to this

    |stats count|eval time_to_close="1 d,0 h, 0 m and 1 s"|eval time_to_close=split(replace(replace(time_to_close," ",":"),",",":"),":")
    |eval time_to_close_sec=tonumber(mvindex(time_to_close,0))*86400+tonumber(mvindex(time_to_close,2))*3600+tonumber(mvindex(time_to_close,5))*60+tonumber(mvindex(time_to_close,8))
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

0 Karma

poete
Builder

Hi,

what about this?

|  makeresults |  eval Parameter="321 d, 10 h, 48 m and 46 s" |eval ts=strptime(Parameter,"%j d, %H h, %M m and %S s")

ts is what you need

0 Karma

pavanae
Builder

@poete I have more than 40 rows. The above solution gives me the solution for just row 1 . Here I want to use the lookup table results (40 rows) and then convert them in a new row. Is there any possibility to get the required result.

0 Karma

renjith_nair
Legend

Try this and if it works for you, then convert all fields similar to this

    |stats count|eval time_to_close="1 d,0 h, 0 m and 1 s"|eval time_to_close=split(replace(replace(time_to_close," ",":"),",",":"),":")
    |eval time_to_close_sec=tonumber(mvindex(time_to_close,0))*86400+tonumber(mvindex(time_to_close,2))*3600+tonumber(mvindex(time_to_close,5))*60+tonumber(mvindex(time_to_close,8))
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

pavanae
Builder

@renjith.nair I have more than 40 rows. The above solution gives me the solution for just row "1 d,0 h, 0 m and 1 s" . Here I want to use the lookup table results (40 rows) and then convert them in a new row. Is there any possibility to get the required result.

0 Karma
Get Updates on the Splunk Community!

Detecting Brute Force Account Takeover Fraud with Splunk

This article is the second in a three-part series exploring advanced fraud detection techniques using Splunk. ...

Buttercup Games: Further Dashboarding Techniques (Part 9)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Buttercup Games: Further Dashboarding Techniques (Part 8)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...