lucagrulla / node-tail

The zero dependency Node.js module for tailing a file
https://www.lucagrulla.com/node-tail/
MIT License
466 stars 76 forks source link

how to tail cross day log file #74

Closed sunweiconfidence closed 6 years ago

sunweiconfidence commented 6 years ago

i have a log.txt file with a prefix date, i want to use node.js to monitor the log.txt file changed line in real time, how to set parameter or other method to tail the 2018-09-15-log.txt file? everyday i only want to tail the current day's log file, thanks

lucagrulla commented 6 years ago

Hi,

Look at the cofiguration part of the README for an example:

https://github.com/lucagrulla/node-tail#configuration

sunweiconfidence commented 6 years ago

but my log file name is changed, so your node-tail configuration is not support now i think, your configuration only support time seperator, tail file name is changing every day, now i intend to use setInterval function to deal with it, any good method to deal with it? thanks for example: tail = new Tail("2018-09-17-log.txt"); tail = new Tail("2018-09-18-log.txt"); tail = new Tail("2018-09-19-log.txt");

lucagrulla commented 6 years ago

If the file name is chaging then the client code has to deal with it. The library handles file rotation accordignly.

sunweiconfidence commented 6 years ago

ok, thank you very much