Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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.

share|improve this answer
    
That looks perfect! Thanks. –  Alex S Jul 10 '11 at 0:59

Sounds like a job for auditd and ausearch

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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