Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I create a cron job that runs every minute and logs how much data was transferred by USB?

Ideally I want log of amount the data in bytes transfers done.

For example if i tranferred 4mb file from my pendrive to my computer system , and then 1 gb file from my computer system to pendrive ,it should log all this .

share|improve this question
2  
What exactly would you like to log? Meta-data of files that have been created/deleted? The contents of files? An estimate of transferred bytes for files and metadata? Do you really want to log data, or are you trying to find out what files enter/leave your computer? –  Lekensteyn Apr 13 at 20:11
    
cron does not feels like it is the correct method to me. –  Rinzwind Apr 13 at 20:16
    
I was creating log analyser of USB devices , so i had to log as much information as available , I stuck on the amount of data in bytes transferred . –  user3529205 Apr 14 at 4:08
add comment

1 Answer 1

up vote 0 down vote accepted

I do not believe cron itself is the correct method but Wireshark has native support for doing a capture on the USB interfaces. From the link:

Linux

To dump USB traffic on Linux, you need the usbmon module, which has existed since Linux 2.6.11. Information on that module is available in /usr/src/linux/Documentation/usb/usbmon.txt in the Linux source tree. Depending on the distribution you're using, and the version of that distribution, that module might be built into the kernel, or might be a loadable module; if it's a loadable module, depending on the distribution you're using, and the version of that distribtuion, it might or might not be loaded for you. If it's a loadable module, and not loaded, you will have to load it with the command

modprobe usbmon

which must be run as root.

share|improve this answer
    
Where does information of capture goes , in which folder ? –  user3529205 Apr 14 at 4:38
    
the default is /var/log/ –  Rinzwind Apr 14 at 6:39
add comment

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.