table of contents
lsoflog(8) | ClusterTools2 | lsoflog(8) |
NAME¶
lsoflog - log the open file list with timestamp
SYNOPSIS¶
lsoflog [ logfile [ pathlist [ timeout ]]]
DESCRIPTION¶
lsoflog logs the open file list with timestamp. Basically the script puts the output of "date +%F %T" in front of each line for the output of "lsof -n -P -X -w -S42 +fg +x +D...".
Default pathlist is "+D/opt +D/srv". A proper pathlist keeps the logfile reasonably small. Non-existing directories cause lsoflog to fail. lsof consumes a noticeable amount of CPU cycles. It should only be activated when needed. Default timeout is 42 seconds.
EXAMPLES¶
- To run lsoflog every 10 minutes, the crontab entry could look like this:
-
-02-57/10 * * * * root /usr/sbin/lsoflog /var/log/lsof.log "+D/db2/data" - To rotate and compress the log from time to time, the logrotate entry could look like this:
-
/var/log/lsof.log {
compress
dateext
maxage 365
rotate 99
size +20M
notifempty
missingok
copytruncate
} - To find all IO to /ora/data that was not done with O_DIRECT just do:
-
awk '$11~/\/ora\/data/ && $8 !~/DIR/ {print $1,$2,$3,$8,$11}' /var/log/lsof.log | sort -u - To see which processes have done ASYNC IO to /ora/data just do:
-
awk '$11~/\/ora\/data/ && $8 ~/AIO/ {print $1,$2,$3,$8,$11}' /var/log/lsof.log | sort -u
EXIT STATUS¶
0 Successful program execution.
>0 Usage, syntax or execution errors.
FILES¶
- /usr/sbin/lsoflog
- the script itself.
- /var/log/lsof.log
- the default logfile.
- /etc/cron.d/ClusterTools2
- the cron entry.
- /etc/logrotate.d/ClusterTools2
- the logrotate entry.
BUGS¶
Non-existing directories cause lsoflog to fail.
Feedback is welcome, please mail to feedback@suse.com
SEE ALSO¶
lsof(1), crontab(5), logrotate(8), open(2), fcntl(2), ClusterTools2(7)
COPYRIGHT¶
(c) 2011-2019 L.Pinne, Germany.
lsoflog comes with ABSOLUTELY NO WARRANTY.
For details see the GNU General Public License at
http://www.gnu.org/licenses/gpl.html
01 Nov 2019 |