loghole.1 16.4 KB
Newer Older
1
.\"
2
.\" Copyright (c) 2004, 2005, 2006, 2007 University of Utah and the Flux Group.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
.\" 
.\" {{{EMULAB-LICENSE
.\" 
.\" This file is part of the Emulab network testbed software.
.\" 
.\" This file is free software: you can redistribute it and/or modify it
.\" under the terms of the GNU Affero General Public License as published by
.\" the Free Software Foundation, either version 3 of the License, or (at
.\" your option) any later version.
.\" 
.\" This file is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
.\" License for more details.
.\" 
.\" You should have received a copy of the GNU Affero General Public License
.\" along with this file.  If not, see <http://www.gnu.org/licenses/>.
.\" 
.\" }}}
22
.\"
23
.TH LOGHOLE 1 "June 16, 2005" "Emulab" "Emulab Commands Manual"
24 25 26 27 28 29 30 31 32 33 34 35 36 37
.OS
.SH NAME
loghole \- Log management tool for experiments.
.SH SYNOPSIS
.BI loghole
[\fB-hVdqva\fR]
[\fB-e \fIpid\fR/\fIeid\fR]
[\fB-s \fIserver\fR]
[\fB-P \fIport\fR]
.I action
[\fI...\fR]
.P
.BI loghole
.BI sync
38
[\fB-nPs\fR]
39 40
[\fB-r \fIremotedir\fR]
[\fB-l \fIlocaldir\fR]
41 42 43
[\fInode1 node2 ...\fR]
.P
.BI loghole
44 45 46
.BI validate
.P
.BI loghole
47 48 49 50 51 52 53 54
.BI archive
[\fB-k \fR(\fBi-delete\fR|\fBspace-is-needed\fR)]
[\fB-a \fIdays\fR]
[\fB-c \fIcomment\fR]
[\fB-d\fR]
[\fIarchive-name\fR]
.P
.BI loghole
55 56 57 58 59 60 61 62
.BI change
[\fB-k \fR(\fBi-delete\fR|\fBspace-is-needed\fR)]
[\fB-a \fIdays\fR]
[\fB-c \fIcomment\fR]
.I archive-name1
[\fIarchive-name2 ...\fR]
.P
.BI loghole
63 64 65 66 67 68 69 70 71 72
.BI list
[\fB-O1!Xo\fR]
[\fB-m \fIatmost\fR]
[\fB-s \fImegabytes\fR]
.P
.BI loghole
.BI show
[\fIarchive-name\fR]
.P
.BI loghole
73
.BI clean
74 75
[\fB-fne\fR]
[\fInode1 node2 ...\fR]
76 77
.P
.BI loghole
78 79 80 81 82 83 84
.BI gc
[\fB-n\fR]
[\fB-m \fIatmost\fR]
[\fB-s \fImegabytes\fR]
.SH DESCRIPTION
The
.B loghole
85
utility downloads log files from certain directories on the experimental nodes
86 87 88
(e.g. "/local/logs") to the Emulab
.I users
machine.  After downloading, it can
89
also be used to produce and manage archives of the log files.  Using this
90 91
utility to manage an experiment's log files is encouraged because it will
transfer the logs in a network-friendly manner and is already integrated with
92 93 94 95
the rest of Emulab.  For example, any programs executed using the Emulab
event-system will have their standard output/error automatically placed in the
"/local/logs" directory.  The tool can also be used to preserve multiple trials
of an experiment by producing and managing zip archives of the logs.
96 97 98 99 100
.P
The set of logs that are actually downloaded by the tool are those located in
.I logholes
on the nodes, where a loghole is simply a well-known directory that acts like a
blackhole for log files.  Any files found in these directories are downloaded
101 102 103 104
to the experiment's log directory (i.e. "/proj/<pid>/exp/<eid>/logs") and
placed under separate directories for each node and loghole.  The referent of
symbolic links are also downloaded, so if you do not want an entire directory
downloaded, you can create links in a loghole to those files of interest.
105
.P
106
To perform its various tasks, the
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
.B loghole
utility is broken up into several sub-actions that you can apply to an
experiment's log holes or log archives.  As a quick example, to synchronize the
logholes for the experiment "neptune/myexp" and create an archive of these logs
you would run:
.RS
.P
.PD 0
[vmars@users ~] loghole -e neptune/myexp sync
.PP
[vmars@users ~] loghole -e neptune/myexp archive
.PD
.RE
.P
The following listing gives a brief overview of the current set of actions,
more detail can be found in later sections of this manual:
.TP
.B sync
Synchronize the experiment's log holes on the nodes with the experiment's log
directory.
.TP
128 129 130
.B validate
Validate that the logs were sync'd correctly by performing some sanity checks.
.TP
131 132 133
.B archive
Archive the contents of the experiment's log directory into a zip file.
.TP
134 135 136
.B change
Change the metadata of an existing archive.
.TP
137 138 139 140 141 142
.B list
Print a brief listing of the archives in the experiment's log directory.
.TP
.B show
Print a detailed listing of the archives in the experiment's log directory.
.TP
143
.B clean
144 145
Clean out the experiment log directory by removing any subdirectories and/or
clean the log directories on the nodes.
146
.TP
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
.B gc
Garbage collect old archives to free up disk space.
.P
Options passed to the utility are split between globally applicable ones that
are placed before the action and action-specific options that are placed after.
For example, the
.B -a
global option will apply an action to all of your experiments and the
.B -X
option for the
.B list
action will list only those files that will be deleted at the next garbage
collection.  To combine these options you would enter:
.RS
.P
[vmars@users ~] loghole -a list -X
.RE
.P
The set of global options is as follows:
.TP
\fB-h\fR, \fB--help
Print the usage message for the
.B loghole
utility as a whole or, if an action is given, the usage message for that
action.
.TP
\fB-V\fR, \fB--version
Print out version information and exit.
.TP
\fB-d\fR, \fB--debug
Output debugging messages.
.TP
\fB-q\fR, \fB--quiet
Decrease the level of verbosity, this is subtractive, so multiple uses of this
option will make the utility quieter and quieter.  The default level of
verbosity is human-readable, below that is machine-readable, and below that is
silent.  For example, the default output from the "list" action looks like:
.P
.RS
.RS
.PD 0
[ ] foobar.1.zip   10/15
.P
[!] foobar.0.zip   10/13
.RE
.PD
.P
Using a single "-q" option changes the output to look like:
.P
.RS
.PD 0
foobar.1.zip
.P
foobar.0.zip
.RE
.PD
.RE
.TP
\fB-e\fR, \fB--experiment\fR=\fIPID\fR/\fIEID\fR
Specify the experiment(s) to operate on.  If multiple
.B -e
options are given, the action will apply to all of them.  This option overrides
the default behavior of inferring the experiment from the current directory
(see the ENVIRONMENT section).
.TP
\fB-a\fR, \fB--all
Perform the action on all existing experiments that you have created.
.TP
\fB-s\fR, \fB--server\fR=\fISERVER
Specify the XML-RPC server to contact for information about the experiment.
Normal users should not have to use this option.
.TP
\fB-P\fR, \fB--port\fR=\fIPORT
Specify the XML-RPC server port to contact for information about the
experiment.  Normal users should not have to use this option.
.P
.SH SYNC
The
.B sync
action is used to synchronize the logholes on the nodes with the experiment's
log directory on the Emulab users machine.  The action will iterate through
each node in the experiment and perform an rsync(1) on the loghole directories
229
for that node.  Currently, the default set of directories that will be synced are "/var/emulab/logs"
230
and "/local/logs".  In addition, if any of the network links in the experiment
231 232 233 234 235 236 237 238 239 240 241
are being traced,
.B loghole
will perform the following extra steps:
.TP
1.
Create a directory for each link.
.TP
2.
Setup symbolic links to the pcap(3) files retrieved from the delay nodes.
.TP
3.
242
Run the pre-shaped pcap(3) files (e.g. *.recv.0) through tcptrace(1) to generate
243 244 245
graphs viewable with xplot(1).  Note that the processing will only be done for
pcap files that were generated by a SNAPSHOT event sent to the tracemon agent.
The "-s" option is provided to automatically send this event for each agent.
246
.P
247 248 249 250 251 252 253 254 255 256 257 258
While the download is in progress,
.B loghole
will display some simple statistics.  The left-hand side of the display shows
the number of nodes remaining to be synced, in progress, and completed.  The
right-hand side shows minimum, average, and maximum amount of time needed to
sync a node.  Finally, a "spinner" on the far right is updated when the
currently active rsync log files have grown, which usually happens when more
files are being synced.
.P
If rsync(1) encounters an error while running, it will automatically be rerun
after a short delay.
.P
259 260
Optional arguments:
.TP
261 262 263 264 265 266 267 268 269 270 271 272
\fB-r\fR, \fB--remote\fR=\fIremotedir
An additional remote directory to sync.  This option is additive, so you can
download several additional directories.
.TP
\fB-l\fR, \fB--local\fR=\fIlocaldir
The local directory to store the downloaded files.  This defaults to the
experiment's log directory.
.TP
\fB-n\fR, \fB--no-standard
Flag that indicates that the standard logholes (i.e. "/var/emulab/logs",
"/local/logs") should not be downloaded.
.TP
273 274 275 276 277 278 279 280 281
\fB-P\fR, \fB--no-post
Do not do any additional post-processing of the log files.  Currently, the only
post-processing is done on the pcap files generated by the link trace agents.
.TP
\fB-s\fR, \fB--snapshot
Send a SNAPSHOT event to the link trace agents before syncing the logfiles.
This is mostly a convenience so you do not have to remember to send the event
before gathering the files.
.TP
282 283 284
\fB-R\fR, \fB--root
Use sudo on the nodes to read files as root.
.TP
285 286 287
.I node1 ...
Specify a subset of virtual or physical nodes that should be synchronized,
otherwise all of the nodes will be synchronized.
288 289 290 291 292 293 294 295 296 297 298 299
.SH VALIDATE
The
.B validate
action is used to check that the logs were sync'd correctly.  Currently, the
following checks are performed:
.TP
program-agent logs
The stdout and stderr logs from program agents are checked by comparing their
metadata against that saved in the accompanying ".status" files.
.TP
valid soft links
All soft links are checked to ensure the referent exists.
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
.SH ARCHIVE
The
.B archive
action is used to archive the logs in an experiment's log directory for future
reference.  The action will produce a standard zip archive with the logs and
some metadata about the experiment and when it can be garbage collected.
.P
Available options:
.TP
\fB-k\fR, \fB--keep-until\fR=(\fIi-delete\fR|\fIspace-is-needed\fR)
Keep the archive until you decide to delete it manually or space is needed.
See the GC section later in the manual to learn how this option and others
affect garbage collection.  (Default: space-is-needed)
.TP
\fB-a\fR, \fB--keep-atleast\fR=\fIN
Keep the archive atleast
.I N
days after creation.  This value keeps the archive from being garbage collected
when more space is needed for atleast the given number of days.  (Default: 3
days)
.TP
\fB-c\fR, \fB--comment\fR=\fICOMMENT
Add a comment to the archive.  This option can be used multiple times to add
more than one comment to the archive.  The comments will be displayed by the
.I show
action and can be useful for storing information about the experiment, for
example, the input parameters.  If the argument to this option is is a single
dash (\fB-\fR) the comment will be read from standard in.
.TP
\fB-d\fR, \fB--delete
330 331 332 333 334 335
After creating the archive, mark the experiment as
.I clean-on-sync
so that any stale data is cleaned out before performing the next
.B sync
operation.  Currently, the mark is a file named ".cleanonsync" in the
experiment log directory.
336 337 338 339 340 341 342 343 344
.SH CHANGE
The
.B change
action is used to change the metadata of an existing archive.  For example, if
after analyzing the log files, you decide that they represent "good" data, you
can add a comment stating that fact and mark the archive as not garbage
collectable.  The action takes the same set of options as the
.B archive
action.
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
.SH LIST
The
.B list
action is used to get a brief summary of all of the log archives found in an
experiment's log directory.  The listing displays the archive name, when it was
created, and its GC status so you can get an idea of when the experiment runs
were performed and what will be garbage collected.
.TP
.B -O
Only list archives that are marked as 'keep until "i-delete"'.
.TP
.B -1
Only list archives that are a day from their keep-atleast date.
.TP
.B -!
Only list archives that are past their keep-atleast date.
.TP
.B -X
Only list archives that are ready to be garbage collected.
.TP
.B -o
List archives that do not match the above flags.  In other words, archives that
will not be deleted at the next garbage collection and are more than a day away
from their keep-atleast dates.
.TP
\fB-m\fR, \fB--keep-atmost\fR=\fIN
Specify how many archives should be kept in the experiment.  This setting
effects what files will be garbage collected, so you should pass this same
option to the
.B gc
if you use a different value from the default of 100 archives.
.TP
\fB-s\fR, \fB--keep-size\fR=\fImegabytes
Specify the maximum total size, in megabytes, for all of the archives in the
experiment.  This setting effects what files will be garbage collected, so you
pass this same option to the
.B gc
if you use a different value from the default of 3MB.
.SH SHOW
The
.B show
action provides a more detailed listing of the log archives for an experiment.
The listing contains information about when and who created the archive, any
attributes used when computing the GC status of the archive, comments attached
to the archive, and a listing of the files in the archive.
.P
Optional arguments:
.TP
.I archive-name
The full or partial name of the archive to display.  If a partial name is
given, any archive names that start with the argument are displayed.  The
default behavior is to display all of the archives in an experiment.
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
.SH CLEAN
The
.B clean
action is used to clean out log files from the experiment's log directory and
the log directories on the nodes.  The default action is to ask confirmation
and then clean out all of the log files.
.P
Available
.B clean
options:
.TP
\fB-f\fR, \fB--force
Do not prompt for confirmation.
.TP
\fB-n\fR, \fB--nodes
Only remove log files on the nodes.
.TP
\fB-e\fR, \fB--experiment
Only remove log directories in the experiment's log directory.
416
.TP
417
\fB-R\fR, \fB--root
418
Use sudo to run the clean as root on the nodes
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
.SH GC
The
.B gc
action is used to garbage collect any archives in order to free up space or
reduce the total number of archives in an experiment.  The process for
selecting files to be garbage collected is as follows:
.TP
1.
If the total number of archives and their total size are below the values
specified by the
.B --keep-atmost
and
.B --keep-size
options then no archives will be deleted, otherwise...
.TP
2.
Any files that are marked as 'keep until "space-is-needed"' and past their
"keep-atleast" dates, will be deleted until the keep-atmost and keep-size
conditions are met.  If deleting these files does not meet these conditions
then...
.TP
3.
The oldest files that are marked 'keep until "space-is-needed"' will be deleted
until the keep-atmost and keep-size conditions are met or there are no more
files that can be deleted without user intervention.
.P
Available
.B gc
options:
.TP
\fB-m\fR, \fB--keep-atmost\fR=\fIN
Specify how many archives should be kept in the experiment.  (Default: 100
archives)
.TP
\fB-s\fR, \fB--keep-size\fR=\fImegabytes
Specify the maximum total size, in megabytes, for all of the archives in the
experiment.  (Default: 3.0 MB)
.SH ENVIRONMENT
By default, the project and experiment ID will be inferred from the current
working directory, if it is inside the experiment's directory
459
(i.e. /proj/\fIpid\fR/exp/\fIeid\fR).  This behavior can be overridden using
460 461 462 463 464
the
.B -e
option.
.SH RETURN VALUES
.TP
465 466 467
3
If rsync reports an error.
.TP
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
2
If there was an error processing the command line arguments.
.TP
0
If the action was completed successfully.
.SH EXAMPLES
.PP
To synchronize the log directory for experiment "neptune/myexp" with the log
holes on the experimental nodes.
.PP
.RS
[vmars@users ~] loghole -e neptune/myexp sync
.RE
.PP
To archive the newly recovered logs and print out just the name of the new log
file:
.PP
.RS
[vmars@users ~] loghole -e neptune/myexp -q archive
.RE
.SH FILES
.TP
/proj/\fIpid\fR/exp/\fIeid\fR/logs
The log directory for an experiment.
492
.TP
493 494 495 496 497 498 499 500
/proj/\fIpid\fR/exp/\fIeid\fR/logs/\fInode
The log directory for a node in the experiment.
.TP
/proj/\fIpid\fR/exp/\fIeid\fR/logs/\fIlink
The log directory for a traced LAN or link.  The symbolic links in these
directories refer to the pcap(3) files for a node connected to this LAN or
link.
.TP
501 502 503 504 505 506 507
/proj/\fIpid\fR/exp/\fIeid\fR/logs/\fIlink\fR/__all.recv.0
The pcap(3) file that contains a merge of all the pre-shaped packets captured
by the link trace agents on this LAN or link.
.TP
/proj/\fIpid\fR/exp/\fIeid\fR/logs/\fIlink\fR/*.xpl
The output of "tcptrace -G" on the __all.recv.0 file.
.TP
508 509 510 511 512 513 514 515
/local/logs
One of the log directories on experimental nodes that is automatically sync'd.
Users should place any logs/data they want transferred back in this directory.
.TP
/var/emulab/logs
Another log directory on experimental nodes that is automatically sync'd.  This
directory usually holds logs generated by the Emulab software running on the
node.
516
.SH SEE ALSO
517 518
event-sched(8), tevc(1), zip(1), rsync(1), pcap(3), mergecap(1), tcptrace(1),
xplot(1)
519 520 521 522 523
.SH AUTHOR
The Emulab project at the University of Utah.
.SH NOTES
The Emulab project can be found on the web at
.IR http://www.emulab.net