LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Centos 7 THUMB drive log? (https://www.linuxquestions.org/questions/linux-newbie-8/centos-7-thumb-drive-log-4175607491/)

Waris 06-07-2017 04:45 PM

Centos 7 THUMB drive log?
 
Hey all,

which/where log file does cantos 7 log when you plug in a writable USB drive into it? I mainly want to see what it says in the log file when you plug in a Thumb drive. Writable thumb drive. not plugging in a mouse or key board usb cables but thumb drives.

Thanks a mill!


Also, to the admins of this page. I am sorry if i have created this thread in the wrong place. I am a newbie. I am trying to do better :D
Thanks for your patience.

syg00 06-07-2017 06:42 PM

systemd use journalctl - but you can still just use dmesg and parse that if you wish.

Waris 06-08-2017 10:19 PM

Thanks for the reply! :D

I am actually trying to find a script or write one that shows a thumb drive. When i inserted a Thumb drive it lists it in dmesg and also /var/log/message. When i view
the devices listed using the command dmesg | grep usb, it gives a lot of info to the connected device. would you happen to know a script that tells me a thumb drive is inserted using the log from /var/log/message?

chrism01 06-09-2017 01:03 AM

You could probably use https://linux.die.net/man/1/inotifywatch or possibly https://linux.die.net/man/8/logwatch or write your own...
In very crude terms:
Code:

tail -f somelog.log |grep <blah>| do-something_here
I have done it using Perl + http://search.cpan.org/~mgrabnar/File-Tail-1.3/Tail.pm

HTH

syg00 06-09-2017 01:03 AM

Should be as simple as being more specific with your grep. Maybe look at the context controls to ensure you have sufficient info - only you can decide if that is also required.


All times are GMT -5. The time now is 06:56 PM.