Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time() function for querying timestamp #12858

Open
LuminatiHD opened this issue May 2, 2024 · 2 comments
Open

Add time() function for querying timestamp #12858

LuminatiHD opened this issue May 2, 2024 · 2 comments
Labels
type/feature Something new we should do

Comments

@LuminatiHD
Copy link

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.

@Amoolaa
Copy link

Amoolaa commented May 6, 2024

+1, desperately need this. Allows us to alert on whether logs from a particular stream have appeared in the last x mins, which can't be done currently with absent_over_time (since that drops all labels)

@JStickler JStickler added the type/feature Something new we should do label May 13, 2024
@MarcSollie
Copy link

+1, really need this as well. Have been searching for an hour for something like this, because I couldn't believe it didn't exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature Something new we should do
Projects
None yet
Development

No branches or pull requests

4 participants