Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a better way to monitor log files?(linux/python)

I'm trying to monitor log files that some process are running on linux(to create a joint log file where log entries are grouped together by when they happen). Currently I'm thinking of opening the files being logged, polling with inotify(or wrapper) and then checking if I can read any more of the file.

Is there any better way to do this? Perhaps some library which abstracts the reading/changes in the files watched?

like image 785
Roman A. Taycher Avatar asked Oct 09 '22 10:10

Roman A. Taycher


1 Answers

Why won't a "tail -f" be sufficient? You could use popen and pipes to handle this from Python.

like image 61
Roger Avatar answered Oct 13 '22 10:10

Roger