graylog2-server icon indicating copy to clipboard operation
graylog2-server copied to clipboard

Keyword time range search behavior

Open r-duran opened this issue 11 years ago • 11 comments

Hi,

When I use "yesterday" keyword graylog resolves it to "From 2015-03-05 14:23:31 to 2015-03-06 14:23:31" so it is practicaly last 24 hours. When I use "today" keyword graylog resolves it to "From 2015-03-06 14:23:31 to 2015-03-06 14:23:31" so it is practicaly "now" and useless.

If current time is 2015-03-06 14:23:31 what I expect is;

yesterday resolves to From 2015-03-05 00:00:00 to 2015-03-05 23:59:59 today resolves to From 2015-03-06 00:00:00 to 2015-03-06 14:23:31

So is this a bug or expected behavior?

r-duran avatar Mar 09 '15 06:03 r-duran

Graylog is using the natty library for natural language date parsing and those results are basically what natty returns for these keywords.

This being said, I agree that keywords like "today", "yesterday", or even "last week" should be normalized to start at the beginning of these periods (i. e. 00:00:00 instead of the current time of the day).

For reference, your post on the mailing list: https://groups.google.com/forum/#!topic/graylog2/US7H6PtpNQA

joschi avatar Mar 09 '15 08:03 joschi

Could reproduce this with Snapshot graylog-1.0.1-SNAPSHOT-20150310155726.tar.gz

florianpopp avatar Mar 11 '15 11:03 florianpopp

Any hint on when this bug will be fixed? It is useless to use dasboard as is. Becouse of today and yesterday keywords dont work.

Also did you false referenced f44f6a9 and d04f084? Becouse it seems they fix different problems not this.

r-duran avatar May 12 '15 07:05 r-duran

Yes, the commit should've referenced the web-interface project, instead of this, see Graylog2/graylog2-web-interface#1047

kroepke avatar May 12 '15 07:05 kroepke

@r-duran have you tried: "yesterday midnight to today midnight" ?

kroepke avatar May 12 '15 08:05 kroepke

Well it resolves to "From 2015-05-11 03:00:00 to 2015-05-12 03:00:00" beter than "yesterday" but it seems it does not process timezone as I am GMT +3 (Europe/istanbul)

r-duran avatar May 12 '15 08:05 r-duran

you can add timezone offsets to the dates, too: "yesterday midnight +0200 to today midnight +0200" converts to "From 2015-05-11 00:00:00 to 2015-05-12 00:00:00" for me today.

kroepke avatar May 12 '15 08:05 kroepke

Thank you ver much :) With your advices I can workaround current problems and get what I want it seesms.

Also "now to today midnight" resolves to "From 2015-05-12 03:00:00 to 2015-05-12 11:21:48" which is correct without timezone but "today midnight to now" resolves to "From 2015-05-12 03:00:00 to 2015-05-12 03:00:00" which is useless.

Anyways thanks again :)

r-duran avatar May 12 '15 08:05 r-duran

Good to hear!

We will add this to the documentation to make it clearer how to achieve this.

kroepke avatar May 12 '15 08:05 kroepke

I created a pull request in Graylog2/documentation#23 which will be merged soon. Closing this issue.

bernd avatar Jun 10 '15 13:06 bernd

The problem with +0300 is that it does not cover daylight saving time and thus requires dashboards to be recreated twice a year. Natty development seems to be dead now. Aren't you considering you'd revive it a bit? I'd try to provide a PR for this issue, but the improvement wouldn't appear in Graylog anyway.

jsmucr avatar Oct 27 '17 13:10 jsmucr