NRQL query to check deployments in last 24 hours

I am trying to create a dashboard with NRQL query showing me all the deployments done in last 24 hours. I am struggling with how to remove the duplicate entries I see with same createdAt field but different timestamps

My query looks like this
FROM K8sDeploymentSample SELECT deploymentName, createdAt limit max ORDER BY createdAt DESC

Maybe try like:

FROM K8sDeploymentSample SELECT latest(createdAt) facet deploymentName limit max

1 Like

Hi @Deepak_Krishna1, let me know how @6MM’s suggestion worked out and we’ll look into it further!

Awesome Thanks @6MM ! @nmcnamara that works perfectly for me.

Hi, this retrieves to me since several months ago. Is there a way to retrieve only from the last 24 or 48 hours?

Add SINCE 1 day ago or SINCE 2 days ago to the query.

If that gives you a date of a few months back then you may have your time context set to a few months back when you are running the query.

I would add also that using 1 day or 2 days is not the same as saying 24 or 48 hours.

Using 1 day or 2 days is not the same as saying 24 or 48 hours

Hi, @6MM: Can you provide an example that demonstrates this? I get the same results using SINCE 1 day ago and SINCE 24 hours ago:

Hi, we tried doing so, but for some reason it brings up things that are older than 1 day ago.

It seems like createdAt and timestamp don’t match. SINCE 1 day ago is looking at the event timestamp.