mtools icon indicating copy to clipboard operation
mtools copied to clipboard

Different mlogfilter timezone behavior between stdin and file given on CLI

Open nahoj opened this issue 3 years ago • 0 comments

mlogfilter seems to interpret --from 2022-11-22T00:00:00 and --to 2022-11-22T00:00:00 in my local time zone for files given as CLI arguments but in UTC for logs given on the standard input.

Or to ignore the offset in logs given on stdin?

Expected behavior

I'd like mlogfilter to always use my local time zone.

Actual/current behavior

➜  mongo cat my.log
2022-11-22T00:00:02.933+0100 I NETWORK [listener] connection accepted from 1.2.3.4:36032 #96426 (121 connections now open)
➜  mongo
➜  mongo mlogfilter my.log --from 2022-11-22T00:00:00 
2022-11-22T00:00:02.933+0100 I NETWORK [listener] connection accepted from 1.2.3.4:36032 #96426 (121 connections now open)
➜  mongo <my.log mlogfilter --from 2022-11-22T00:00:00 
➜  mongo <my.log mlogfilter --from 2022-11-21T23:00:00 
2022-11-22T00:00:02.933+0100 I NETWORK [listener] connection accepted from 1.2.3.4:36032 #96426 (121 connections now open)
➜  mongo
➜  mongo <my.log mlogfilter --timezone 1 --from 2022-11-22T00:00:00 --to 2022-11-22T01:00:00
2022-11-22T01:00:02.933+0100 I NETWORK [listener] connection accepted from 1.2.3.4:36032 #96426 (121 connections now open)
➜  mongo mlogfilter my.log --timezone 1 --from 2022-11-22T00:00:00 --to 2022-11-22T01:00:00
➜  mongo 

Environment

➜  mongo mlogfilter --version                                                              
mtools version 1.7.2 || Python 3.10.8 (main, Oct 13 2022, 09:48:40) [Clang 14.0.0 (clang-1400.0.29.102)]
Software Version
mtools 1.7.2
Python 3.10.8
MongoDB server 4.2.19
Operating system (my laptop, not the server) macOS Monterey 12.6.1

nahoj avatar Dec 08 '22 17:12 nahoj