pino-pretty icon indicating copy to clipboard operation
pino-pretty copied to clipboard

How to filter the log time?

Open luzianscherrer opened this issue 5 years ago • 4 comments

The --search parameter is great for searching within the JSON content but how would I filter the logs for the timestamp? Let's say I wanted all log entries from 17:10 to 17:19, how would I do that?

luzianscherrer avatar Nov 09 '18 10:11 luzianscherrer

I don't know. We support http://jmespath.org/examples.html as the syntax. Would you like to send a PR with an example?

mcollina avatar Nov 09 '18 13:11 mcollina

I just realized that my question was a bit unclear, sorry about that. What I wanted to ask is: In the logfile I have the time logged as 1541774026820 for example. How could I formulate a search query along the lines of time >= 2018-11-09 17:10:00?

luzianscherrer avatar Nov 09 '18 14:11 luzianscherrer

http://getpino.io/#/docs/help?id=filter-logs

Convert your starting time to milliseconds and proceed with filtering.

jsumners avatar Nov 09 '18 16:11 jsumners

Thanks, that's how I'm currently doing it. I was actually hoping for some date/time arithmetic logic in the search query.

luzianscherrer avatar Nov 09 '18 16:11 luzianscherrer