SYSDIG(8)
π NAME π
okay so bestie, meet sysdig(8) β sysdig is the definitive system and process troubleshooting tool. Periodt. π«Ά
πΈ SYNOPSIS πΈ
sysdig [option]... [filter]
β¨ DESCRIPTION β¨
First note, bestie: if youβre interested in an easier to use interface for the sysdig functionality, use the csysdig command line utility. π
sysdig is a tool for system troubleshooting, analysis and exploration. It can capture, filter and decode system calls and other OS events. sysdig can be both used to inspect live systems, or to generate trace files that can be analyzed at a later stage.
It includes a powerful filtering language, has customizable output, and can be extended through Lua scripts, called chisels. iconic behavior, honestly. π
π Output format π
By default, sysdig prints the information for each captured event on a single line, with the following format:
*%evt.num %evt.time %evt.cpu %proc.name (%thread.tid) %evt.dir %evt.type %evt.info
where:
evt.numβ the incremental event numberevt.timeβ the event timestampevt.cpuβ the CPU number where the event was capturedproc.nameβ the name of the process that generated the eventthread.tidβ the TID that generated the event, which corresponds to the PID for single thread processesevt.dirβ the event direction,>for enter events and<for exit eventsevt.typeβ the name of the event, e.g.'open'or'read'evt.argsβ the list of event arguments
The output format can be customized with the -p switch, using any of the fields listed by sysdig -l. β¨
Using -pc or -pcontainer, the default format will be changed to a container-friendly one:
*%evt.num %evt.time %evt.cpu %container.name (%container.id) %proc.name (%thread.tid:%thread.vtid) %evt.dir %evt.type %evt.info
π¦ Trace Files π¦
A trace file can be created using the -w switch:
$ sysdig -w trace.scap
The -s switch can be used to specify how many bytes of each data buffer should be saved to disk. And filters can be used to save only certain events to disk:
$ sysdig -s 2000 -w trace.scap proc.name=cat
Trace files can be read using the -r switch:
$ sysdig -r trace.scap
π Filtering π
sysdig filters are specified at the end of the command line. The simplest filter is a basic field-value check:
$ sysdig proc.name=cat
The list of available fields can be obtained with sysdig -l. Filter expressions can use one of these comparison operators: =, !=, <, <=, >, >=, contains, icontains, in and exists. e.g.
$ sysdig fd.name contains /etc
$ sysdig "evt.type in ( 'select', 'poll' )"
$ sysdig proc.name exists
Multiple checks can be combined through brackets and the following boolean operators: and, or, not. e.g.
$ sysdig "not (fd.name contains /proc or fd.name contains /dev)"
π§ Chisels π§
sysdigβs chisels are little scripts that analyze the sysdig event stream to perform useful actions. To get the list of available chisels, type
$ sysdig -cl
To get details about a specific chisel, type
$ sysdig -i spy_ip
To run one of the chisels, you use the -c flag, e.g.
$ sysdig -c topfiles_bytes
If a chisel needs arguments, you specify them after the chisel name:
$ sysdig -c spy_ip 192.168.1.157
If a chisel has more than one argument, specify them after the chisel name, enclosed in quotes:
$ sysdig -c chisel_name "arg1 arg2 arg3"
Chisels can be combined with filters:
$ sysdig -c topfiles_bytes "not fd.name contains /dev"
π₯ OPTIONS π₯
okay bestie, here come the flags β every single one, no gatekeeping. π
-A,--print-asciiβ Only print the text portion of data buffers, and echo end-of-lines. This is useful to only display human-readable data.-b,--print-base64β Print data buffers in base64. This is useful for encoding binary data that needs to be used over media designed to handle textual data (i.e., terminal or json).-cchiselname chiselargs,--chisel=chiselname chiselargsβ run the specified chisel. If the chisel require arguments, they must be specified in the command line after the name.-Cfilesize β Break a capture into separate files, and limit the size of each file based on the specified number of megabytes. The units offilesizeare millions of bytes (10^6, not 2^20). Use in conjunction with-Wto enable automatic file rotation. Otherwise, new files will continue to be created until the capture is manually stopped.
Files will have the name specified by -w with a counter added starting at 0.
-cl,--list-chiselsβ lists the available chisels. Sysdig looks for chisels in the following directories:./chisels,~/.chiselsand/usr/share/sysdig/chisels.-d,--displayfltβ Make the given filter a display one. Setting this option causes the events to be filtered after being parsed by the state system. Events are normally filtered before being analyzed, which is more efficient, but can cause state (e.g. FD names) to be lost.-D,--debugβ Capture events about sysdig itself, display internal events in addition to system events, and print additional logging on standard error.-E,--exclude-usersβ Donβt create the user/group tables by querying the OS when sysdig starts. This also means that no user or group info will be written to the tracefile by the-wflag. The user/group tables are necessary to use filter fields likeuser.nameorgroup.name. However, creating them can increase sysdigβs startup time. Moreover, they contain information that could be privacy sensitive.-enumevents β Break a capture into separate files, and limit the size of each file based on the specified number of events. Use in conjunction with-Wto enable automatic file rotation. Otherwise, new files will continue to be created until the capture is manually stopped.
Files will have the name specified by -w with a counter added starting at 0.
-F,--fatfileβ Enable fatfile mode. When writing in fatfile mode, the output file will contain events that will be invisible when reading the file, but that are necessary to fully reconstruct the state. Fatfile mode is useful when saving events to disk with an aggressive filter. The filter could drop events that would cause the state to be updated (e.g.clone()oropen()). With fatfile mode, those events are still saved to file, but'hidden'so that they wonβt appear when reading the file. Be aware that using this flag might generate substantially bigger traces files.--filter-proclistβ apply the filter to the process table. A full dump of/procis typically included in any trace file to make sure all the state required to decode events is in the file. This could cause the file to contain unwanted or sensitive information. Using this flag causes the command line filter to be applied to the/procdump as well.-Gnumseconds β Break a capture into separate files, and limit the size of each file based on the specified number of seconds. Use in conjunction with-Wto enable automatic file rotation. Otherwise, new files will continue to be created until the capture is manually stopped.
Files will have the name specified by -w which should include a time format as defined by strftime(3). If no time format is specified, a counter will be used.
-h,--helpβ Print this page.-Hpluginname[:initconfig],--plugin pluginname[:initconfig]β Registers a plugin, using the passed init config if present. A path can also be used aspluginname. The format ofinitconfis controlled by the plugin, refer to each pluginβs documentation to learn about it.-Ipluginname[:openparams],--input pluginname[:openparams]β Capture events using the plugin with namepluginname, passing to the plugin theopenparamsstring as parameters. The format ofinputargsis controller by the plugin, refer to each pluginβs documentation to learn about it. The event sources available for capture vary depending on which plugins have been installed. You can list the plugins that have been loaded by using the-Ilflag.-Il,--list-inputsβ List the loaded plugins. Sysdig looks for plugins in the following directories:./plugins,~/.plugins,/usr/share/sysdig/plugins.--plugin-config-fileβ Load the plugin configuration from a Falco-compatible yaml config file. Mixing this option with-Hor-Iis unsupported. See the plugin section inhttps://falco.org/docs/configuration/for additional informations.-ichiselname,--chisel-info=chiselname β Get a longer description and the arguments associated with a chisel found in the-cloption list.-j,--jsonβ Emit output as json, data buffer encoding will depend from the print format selected.-k,--k8s-apiβ Enable Kubernetes support by connecting to the API server specified as argument. E.g."http://admin:password@127.0.0.1:8080". The API server can also be specified via the environment variableSYSDIG_K8S_API.-Kbtfile | certfile:keyfile[#password][:cacertfile],--k8s-api-cert=btfile | certfile:keyfile[#password][:cacertfile] β Use the provided files names to authenticate user and (optionally) verify the K8S API server identity. Each entry must specify full (absolute, or relative to the current directory) path to the respective file. Private key password is optional (needed only if key is password protected). CA certificate is optional. For all files, only PEM file format is supported. Specifying CA certificate only is obsoleted - when single entry is provided for this option, it will be interpreted as the name of a file containing bearer token. Note that the format of this command-line option prohibits use of files whose names contain':'or'#'characters in the file name. Option can also be provided via the environment variableSYSDIG_K8S_API_CERT.-L,--list-eventsβ List the events that the engine supports.-l,--listβ List the fields that can be used for filtering and output formatting. Use-lvto get additional information for each field.--list-markdownβ Like-l, but produces markdown output.-m url[,marathon-url],--mesos-api=_url[,marathon-url]_β turns on Mesos support by connecting to the API server you pass in (likehttp://admin:password@127.0.0.1:5050, credentials and all β¨). The Mesos url is required, bestie, no skipping it. The Marathon url is optional and defaults to auto-follow β meaning if you don't hand over a Marathon API server, sysdig will try to fetch the location of the Marathon API server from the Mesos master, and then keep following it if it migrates. π§ Heads up though: with auto-follow, sysdig will likely get a cluster-internal IP address for the Marathon API server, so running sysdig with Marathon auto-follow from a node that isn't part of the Mesos cluster may just not work π. Also, running sysdig with Mesos support on a node that has no containers managed by Mesos is of limited use β you'll still collect cluster metadata, but there'll be no Mesos/Marathon filtering capability. The API servers can also be specified via the environment variableSYSDIG_MESOS_APIπ«Ά-M num_secondsβ stop collecting after reaching... yeah, the sentence trails off in the original like a text you sent at 3am π β that's literally how it reads.-n num,--numevents=numβ stop capturing afternumevents.--page-faultsβ capture user/kernel major/minor page faults.-P,--progressβ print progress on stderr while processing trace files.-p outputformat,--print=outputformatβ pick the format used when printing the events π. With-pcor-pcontaineryou get a container-friendly format. With-pkor-pkubernetesyou get a kubernetes-friendly format. With-pmor-pmesosyou get a mesos-friendly format. And specifying-ppon the command line makes sysdig print the default command line format and exit β iconic little flex π-q,--quietβ don't print events on the screen. Genuinely useful when you're dumping to disk (no one needs that visual noise β€οΈ).-r readfile,--read=readfileβ read the events fromreadfile.-R,--resolve-portsβ resolve port numbers to names.-S,--summaryβ print the event summary (i.e. the list of the top events) when the capture ends.-s len,--snaplen=lenβ capture the firstlenbytes of each I/O buffer. By default, the first80bytes are captured. Use this option with caution β it can generate huge trace files ππ₯-t timetype,--timetype=timetypeβ change the way event time is displayed β°. Accepted values:hβ human-readable stringaβ absolute timestamp from epochrβ relative time from the first displayed eventdβ delta between event enter and exitDβ delta from the previous event
-T,--force-tracers-captureβ tells the driver to make sure full buffers are captured from/dev/null, so tracers are completely captured π¦. Ngl, sysdig will enable extended/dev/nullcapture by itself after it detects tracers are written there β but that could result in the truncation of some tracers at the beginning of the capture. This option lets you prevent that.--unbufferedβ turns off output buffering. Every single line sysdig emits gets flushed, which means higher CPU usage but it's chef's kiss when you're piping sysdig's output into another process or into a script π-v,--verboseβ verbose output. This flag makes the full content of text and binary buffers print on screen instead of being truncated to40characters. Note the data buffers length is still limited by the snaplen (see the-sflag docs). Also,-vmakes sysdig print some summary information at the end of the capture β¨--versionβ print version number.-w writefile,--write=writefileβ write the captured events towritefile.-W numβ turns on file rotation for continuous capture and limits the number of files created tonum. Once the cap is reached, older files get overwritten (ring buffer energy π). Use it together with the-C/-G/-eoptions to limit the size of each file based on number of megabytes, seconds, and/or events (respectively).-x,--print-hexβ print data buffers in hex.-X,--print-hex-asciiβ print data buffers in hex and ASCII.-z,--compressβ used with-w, enables compression for tracefiles π
π EXAMPLES π
Capture all the events from the live system and print them to screen
$ sysdig
Capture all the events from the live system and save them to disk
$ sysdig -w dumpfile.scap
Capture all the events in the latest 24 hours and save them to disk, organized in files containing 1 hour of system activity each
$ sysdig -G 3600 -W 24 -w dumpfile.scap
Read events from a file and print them to screen
$ sysdig -r dumpfile.scap
Prepare a sanitized version of a system capture
$ sysdig -r dumpfile.scap 'not evt.buffer contains foo' -w cleandump.scap
Print all the open system calls invoked by cat
$ sysdig proc.name=cat and evt.type=open
Print the name of the files opened by cat
$ sysdig -p"%evt.arg.name" proc.name=cat and evt.type=open
List the available chisels
$ sysdig -cl
Use the spy_ip chisel to look at the data exchanged with 192.168.1.157:
$ sysdig -c spy_ip 192.168.1.157
π FILES π
/usr/share/sysdig/chiselsβ the global chisels directory.~/.chiselsβ the personal chisels directory (yes, your own little chisel stash π).
π BUGS π
- sysdig and its chisels are designed to be used with LuaJIT in Lua 5.1 mode. While it is possible to use sysdig with LuaJIT in Lua 5.2 mode or regular Lua, some chisels may not work as expected β so like, don't come for me if a chisel acts up π
π AUTHOR π
Draios Inc. aka sysdig info@sysdigcloud.com
πΈ SEE ALSO πΈ
csysdig(8), strace(8), tcpdump(8), lsof(8)
That's the whole page, bestie β the footer at the very bottom is just the usual source/version and date line that every manpage wears like a little name tag, so consider this your cute sign-off instead: go forth, capture some syscalls, and slay π π
π¦ where this page comes from
- arch rolling: sysdig 0.41.4-3 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms