Python how to configure hooks to track I / O events

My application uploads files, creates files as final / intermediate data. I would like to configure the hook (outside the application) to warn / log whenever my application performs any I / O operations - for example, writing a file, deleting a file, downloading a file from a file server. I use urllib to retrieve file files from data servers.

+3
source share
2 answers

If you know where the file will be uploaded, one solution might be to use inotify. In particular, pyinotify seems interesting. I don't know if CentOS has a recent version of the Linux kernel for this to work.

+2
source

If you need a list of the operations of your process file, you can use FileMon or ProcMon from SysInternals.

Edit: For Linux, you can use strace.

+1
source

Source: https://habr.com/ru/post/1776895/


All Articles