Linux "sudoreplay" Command Line Options and Examples
replay sudo session logs

sudoreplay plays back or lists the output logs created by sudo. When replaying, sudoreplay can play the session back in real-time, or the playback speed may be adjusted (faster or slower) based on the command line options. The ID should either be a six character sequence of digits and upper case letters, e.


Usage:

sudoreplay [-hnR] [-d dir] [-f filter] [-m num] [-s num] ID


   sudoreplay [-h] [-d dir] -l [search expression]






Command Line Options:

-d
Store session logs in dir instead of the default, /var/log/sudo-io.
sudoreplay -d ...
-f
Select which I/O type(s) to display. By default, sudoreplay will display the command's standardoutput, standard error and tty output. The filter argument is a comma-separated list, consisting ofone or more of following: stdin, stdout, stderr, ttyin, and ttyout.
sudoreplay -f ...
-h
--help Display a short help message to the standard output and exit.
sudoreplay -h ...
-l
Enable “list mode”. In this mode, sudoreplay will list available sessions in a format similar tothe sudo log file format, sorted by file name (or sequence number). If a search expression is spec‐ified, it will be used to restrict the IDs that are displayed. An expression is composed of thefollowing predicates:command patternEvaluates to true if the command run matches the POSIX extended regular expression pattern.cwd directoryEvaluates to true if the command was run with the specified current working directory.fromdate dateEvaluates to true if the command was run on or after date. See Date and time format for adescription of supported date and time formats.group runas_groupEvaluates to true if the command was run with the specified runas_group. Note that unless arunas_group was explicitly specified when sudo was run this field will be empty in the log.runas runas_userEvaluates to true if the command was run as the specified runas_user. Note that sudo runscommands as user root by default.todate dateEvaluates to true if the command was run on or prior to date. See Date and time format fora description of supported date and time formats.tty tty nameEvaluates to true if the command was run on the specified terminal device. The tty nameshould be specified without the /dev/ prefix, e.g. tty01 instead of /dev/tty01.user user nameEvaluates to true if the ID matches a command run by user name.Predicates may be abbreviated to the shortest unique string.Predicates may be combined using and, or and ! operators as well as ‘(’ and ‘)’ grouping (note thatparentheses must generally be escaped from the shell). The and operator is optional, adjacent pred‐icates have an implied and unless separated by an or.
sudoreplay -l ...
-m
Specify an upper bound on how long to wait between key presses or output data. By default,sudoreplay will accurately reproduce the delays between key presses or program output. However,this can be tedious when the session includes long pauses. When the -m option is specified,sudoreplay will limit these pauses to at most max_wait seconds. The value may be specified as afloating point number, e.g. 2.5.
sudoreplay -m ...
-n
Do not prompt for user input or attempt to resize the terminal. The session is written to the stan‐dard output, not directly to the user's terminal.
sudoreplay -n ...
-R
Do not attempt to resize the terminal to match the terminal size of the session.
sudoreplay -R ...
-s
This option causes sudoreplay to adjust the number of seconds it will wait between key presses orprogram output. This can be used to slow down or speed up the display. For example, a speed_factorof 2 would make the output twice as fast whereas a speed_factor of .5 would make the output twice asslow.
sudoreplay -s ...
-V
Print the sudoreplay versions version number and exit.Date and time formatThe time and date may be specified multiple ways, common formats include:HH:MM:SS am MM/DD/CCYY timezone24 hour time may be used in place of am/pm.HH:MM:SS am Month, Day Year timezone24 hour time may be used in place of am/pm, and month and day names may be abbreviated. Note that monthand day of the week names must be specified in English.CCYY-MM-DD HH:MM:SSISO time formatDD Month CCYY HH:MM:SSThe month name may be abbreviated.Either time or date may be omitted, the am/pm and timezone are optional. If no date is specified, the currentday is assumed; if no time is specified, the first second of the specified date is used. The less significantparts of both time and date may also be omitted, in which case zero is assumed.The following are all valid time and date specifications:now The current time and date.tomorrowExactly one day from now.yesterday24 hours ago.2 hours ago2 hours ago.next FridayThe first second of the Friday in the next (upcoming) week. Not to be confused with “this Friday” whichwould match the Friday of the current week.last weekThe current time but 7 days ago. This is equivalent to “a week ago”.a fortnight agoThe current time but 14 days ago.10:01 am 9/17/200910:01 am, September 17, 2009.10:01 am10:01 am on the current day.10 10:00 am on the current day.9/17/200900:00 am, September 17, 2009.10:01 am Sep 17, 200910:01 am, September 17, 2009.Note that relative time specifications do not always work as expected. For example, the “next” qualifier isintended to be used in conjunction with a day such as “next Monday”. When used with units of weeks, months,years, etc the result will be one more than expected. For example, “next week” will result in a time exactlytwo weeks from now, which is probably not what was intended. This will be addressed in a future version ofsudoreplay.Debugging sudoreplaysudoreplay versions 1.8.4 and higher support a flexible debugging framework that is configured via Debug linesin the sudo.conf(5) file.For more information on configuring sudo.conf(5), please refer to its manual.FILES/etc/sudo.conf Debugging framework configuration/var/log/sudo-io The default I/O log directory./var/log/sudo-io/00/00/01/logExample session log info./var/log/sudo-io/00/00/01/stdinExample session standard input log./var/log/sudo-io/00/00/01/stdoutExample session standard output log./var/log/sudo-io/00/00/01/stderrExample session standard error log./var/log/sudo-io/00/00/01/ttyinExample session tty input file./var/log/sudo-io/00/00/01/ttyoutExample session tty output file./var/log/sudo-io/00/00/01/timingExample session timing file.Note that the stdin, stdout and stderr files will be empty unless sudo was used as part of a pipeline for a par‐ticular command.EXAMPLESList sessions run by user millert:# sudoreplay -l user millertList sessions run by user bob with a command containing the string vi:# sudoreplay -l user bob command viList sessions run by user jeff that match a regular expression:# sudoreplay -l user jeff command '/bin/[a-z]*sh'List sessions run by jeff or bob on the console:# sudoreplay -l ( user jeff or user bob ) tty console
sudoreplay -V ...