blob: 21bd87b888cbb12d42c921ee63c15e16e0e0ee1f [file] [log] [blame]
.TH opensnoop 8 "2015-08-18" "USER COMMANDS"
.SH NAME
opensnoop \- Trace open() syscalls. Uses Linux eBPF/bcc.
.SH SYNOPSIS
.B opensnoop [\-h] [\-T] [\-x] [\-p PID] [\-t TID] [\-n name]
.SH DESCRIPTION
opensnoop traces the open() syscall, showing which processes are attempting
to open which files. This can be useful for determining the location of config
and log files, or for troubleshooting applications that are failing, specially
on startup.
This works by tracing the kernel sys_open() function using dynamic tracing, and
will need updating to match any changes to this function.
This makes use of a Linux 4.5 feature (bpf_perf_event_output());
for kernels older than 4.5, see the version under tools/old,
which uses an older mechanism.
Since this uses BPF, only the root user can use this tool.
.SH REQUIREMENTS
CONFIG_BPF and bcc.
.SH OPTIONS
.TP
\-h
Print usage message.
.TP
\-T
Include a timestamp column.
.TP
\-x
Only print failed opens.
.TP
\-p PID
Trace this process ID only (filtered in-kernel).
.TP
\-t TID
Trace this thread ID only (filtered in-kernel).
.TP
\-n name
Only print processes where its name partially matches 'name'
.SH EXAMPLES
.TP
Trace all open() syscalls:
#
.B opensnoop
.TP
Trace all open() syscalls, and include timestamps:
#
.B opensnoop \-T
.TP
Trace only open() syscalls that failed:
#
.B opensnoop \-x
.TP
Trace PID 181 only:
#
.B opensnoop \-p 181
.TP
Trace all open() syscalls from processes where its name partially matches 'ed':
#
.B opensnoop \-n ed
.SH FIELDS
.TP
TIME(s)
Time of the call, in seconds.
.TP
PID
Process ID
.TP
TID
Thread ID
.TP
COMM
Process name
.TP
FD
File descriptor (if success), or -1 (if failed)
.TP
ERR
Error number (see the system's errno.h)
.TP
PATH
Open path
.SH OVERHEAD
This traces the kernel open function and prints output for each event. As the
rate of this is generally expected to be low (< 1000/s), the overhead is also
expected to be negligible. If you have an application that is calling a high
rate of open()s, then test and understand overhead before use.
.SH SOURCE
This is from bcc.
.IP
https://github.com/iovisor/bcc
.PP
Also look in the bcc distribution for a companion _examples.txt file containing
example usage, output, and commentary for this tool.
.SH OS
Linux
.SH STABILITY
Unstable - in development.
.SH AUTHOR
Brendan Gregg
.SH SEE ALSO
funccount(1)