Is there a linux kernel module or perhaps a different filesystem to keep a running total of the number of times a file has been opened?

I realize this bit would be asking a lot, but if you could also tune it so it doesn't increment the count unless x% of the file was read while it was open, that would be fantastic.

Thanks.

link|improve this question

77% accept rate
feedback

2 Answers

up vote 3 down vote accepted

Yes! This would be the inotify system. It's built into the kernel, you just have to hook it. One of the events you can monitor are file-open (IN_OPEN) and file-close (IN_CLOSE). Once you've built a tool to monitor things you can get these counts pretty simply. Unfortunately, it doesn't event on percent-read, just read.

link|improve this answer
That looks perfect! Thanks. – Shadow Jul 10 '11 at 0:59
feedback

Sounds like a job for auditd and ausearch

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.