=head1 NAME

virt-log - Display log files from a virtual machine

=head1 SYNOPSIS

 virt-log [--options] -d domname

 virt-log [--options] -a disk.img [-a disk.img ...]

=head1 DESCRIPTION

C<virt-log> is a command line tool to display the log files from the
named virtual machine (or disk image).

This tool understands and displays both plain text log files
(eg. F</var/log/messages>) and binary formats such as the systemd
journal.

To display other types of files, use L<virt-cat(1)>.  To follow (tail)
text log files, use L<virt-tail(1)>.  To copy files out of a virtual
machine, use L<virt-copy-out(1)>.  To display the contents of the
Windows Registry, use L<virt-win-reg(1)>.

=head1 EXAMPLES

Display the complete logs from a guest:

 virt-log -d mydomain | less

Find out what DHCP IP address a VM acquired:

 virt-log -d mydomain | grep 'dhclient.*bound to'

=head1 OPTIONS

=over 4

=item B<--help>

Display brief help.

=item B<-a> file

=item B<--add> file

Add I<file> which should be a disk image from a virtual machine.  If
the virtual machine has multiple block devices, you must supply all of
them with separate I<-a> options.

The format of the disk image is auto-detected.  To override this and
force a particular format use the I<--format=..> option.

=item B<-a URI>

=item B<--add URI>

Add a remote disk.  See L<guestfish(1)/ADDING REMOTE STORAGE>.

=item B<-c> URI

=item B<--connect> URI

If using libvirt, connect to the given I<URI>.  If omitted, then we
connect to the default libvirt hypervisor.

If you specify guest block devices directly (I<-a>), then libvirt is
not used at all.

=item B<-d> guest

=item B<--domain> guest

Add all the disks from the named libvirt guest.  Domain UUIDs can be
used instead of names.

=item B<--echo-keys>

When prompting for keys and passphrases, virt-log normally turns
echoing off so you cannot see what you are typing.  If you are not
worried about Tempest attacks and there is no one else in the room you
can specify this flag to see what you are typing.

=item B<--format=raw|qcow2|..>

=item B<--format>

The default for the I<-a> option is to auto-detect the format of the
disk image.  Using this forces the disk format for I<-a> options which
follow on the command line.  Using I<--format> with no argument
switches back to auto-detection for subsequent I<-a> options.

For example:

 virt-log --format=raw -a disk.img

forces raw format (no auto-detection) for F<disk.img>.

 virt-log --format=raw -a disk.img --format -a another.img

forces raw format (no auto-detection) for F<disk.img> and reverts to
auto-detection for F<another.img>.

If you have untrusted raw-format guest disk images, you should use
this option to specify the disk format.  This avoids a possible
security problem with malicious guests (CVE-2010-3851).

=item B<--keys-from-stdin>

Read key or passphrase parameters from stdin.  The default is
to try to read passphrases from the user by opening F</dev/tty>.

=item B<-v>

=item B<--verbose>

Enable verbose messages for debugging.

=item B<-V>

=item B<--version>

Display version number and exit.

=item B<-x>

Enable tracing of libguestfs API calls.

=back

=head1 EXIT STATUS

This program returns 0 if successful, or non-zero if there was an
error.

=head1 SEE ALSO

L<guestfs(3)>,
L<guestfish(1)>,
L<virt-cat(1)>,
L<virt-copy-out(1)>,
L<virt-tail(1)>,
L<virt-tar-out(1)>,
L<virt-win-reg(1)>,
L<http://libguestfs.org/>.

=head1 AUTHOR

Richard W.M. Jones L<http://people.redhat.com/~rjones/>

=head1 COPYRIGHT

Copyright (C) 2010-2017 Red Hat Inc.
