[Kibana] Current System Date

(Peter Alfafara) #1

Hi Experts,

I'd like to ask if the following requirement is possible:

Basically I monitor the state of my database every 30 mins and sends details of database locks to ELK and stores it in a database-lock index. So every 30 mins I need to refresh the Kibana visualization and identify the status of old database locks that was previously captured and new ones that recently arrived in ELK. In my index I have a date field which indicates the date and time when the lock occurred.

What I need to know is how long has it been locked from this moment by comparing the lock occurrence date field to the current system date. I'm having a hard time searching for a way to compare my date field to the systems current date.

Hoping for your response. Thank you.


(kulkarni) #2


Are you looking for a Data Table or a chart of some type? The easiest way is to sort by Date on your lock occurrence date Field and time to get the latest and compare them. Let me know if this works, else we could try and help you with something else.


(Peter Alfafara) #3

Hi rashmi,

Sorry for the late response.

Yes, specifically I'm looking into using the new enhanced data table plugin. Lets say the system date time is 02/12/2018 08:00 PM so what I need is similar to the following:

1 | 02/12/2018 7:00 PM| 60
2 | 02/12/2018 7:30 PM| 30

And so everytime I refresh this data table, the run time changes. I'm trying to figure out how to enable groovy as I think the functionality is available there but I've got no luck. I'm using Kibana 6.1

Hope you can help. Thanks


(Peter Alfafara) #4


I've managed to get the current system date and put it in a scripted field, but when I try to subtract the system date to my lock date time I get an error like this when going to Discover page:

Warning: Courier Fetch 10 of 50 shards failed.

This is my scripted field:

new Date().getTime() - doc['data.time'].value


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.