Skip to content

Add time() function for querying timestamp #12858

Open
@LuminatiHD

Description

@LuminatiHD

Is your feature request related to a problem? Please describe.
I have oftentimes encountered problems which would be solved by being able to use a function which would return the current time/date/timestamp, similar to prometheus' time() function. As an illustrative example, imagine a script which every day logs the timestamp it ran at, and I wanted to write a rule that would check this timestamp to ensure that it does in fact run everyday. In PromQL, this would look something like:
(time() - my_script{output='timestamp'})/3600 < 24
However, I have found no functionality in LogQL which could do something similar.
Describe the solution you'd like
As mentioned, I'd like LogQL to have a function like time() in PromQL.

Describe alternatives you've considered
I have tried a few things with __timestamp__, but that function seems to be built only for templating and not log/metric querying. Or maybe I am doing something wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/featureSomething new we should do

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions