.\" -*- nroff -*-
.de IQ
.  br
.  ns
.  IP "\\$1"
..
.TH ovs\-appctl 8 "@VERSION@" "Open vSwitch" "Open vSwitch Manual"
.ds PN ovs\-appctl
.
.SH NAME
ovs\-appctl \- utility for configuring running Open vSwitch daemons
.
.SH SYNOPSIS
\fBovs\-appctl\fR [\fB\-\-target=\fItarget\fR | \fB\-t\fR \fItarget\fR]
[\fB\-T \fIsecs\fR | \fB\-\-timeout=\fIsecs\fR]
\fIcommand \fR[\fIarg\fR...]
.br
\fBovs\-appctl \fB\-\-help\fR
.br
\fBovs\-appctl \fB\-\-version\fR
.SH DESCRIPTION
Open vSwitch daemons accept certain commands at runtime to control their
behavior and query their settings.  Every daemon accepts a common set of
commands documented under \fBCOMMON COMMANDS\fR below.  Some daemons
support additional commands documented in their own manpages.
\fBovs\-vswitchd\fR in particular accepts a number of additional
commands documented in \fBovs\-vswitchd\fR(8).
.PP
The \fBovs\-appctl\fR program provides a simple way to invoke these
commands.  The command to be sent is specified on \fBovs\-appctl\fR's
command line as non-option arguments.  \fBovs\-appctl\fR sends the
command and prints the daemon's response on standard output.
.PP
In normal use only a single option is accepted:
.IP "\fB\-t \fItarget\fR"
.IQ "\fB\-\-target=\fItarget\fR"
Tells \fBovs\-appctl\fR which daemon to contact.
.IP
If \fItarget\fR begins with \fB/\fR it must name a Unix domain socket
on which an Open vSwitch daemon is listening for control channel
connections.  By default, each daemon listens on a Unix domain socket
named \fB@RUNDIR@/\fIprogram\fB.\fIpid\fB.ctl\fR, where \fIprogram\fR
is the program's name and \fIpid\fR is its process ID.  For example,
if \fBovs\-vswitchd\fR has PID 123, it would listen on
\fB@RUNDIR@/ovs\-vswitchd.123.ctl\fR.
.IP
Otherwise, \fBovs\-appctl\fR looks for a pidfile, that is, a file
whose contents are the process ID of a running process as a decimal
number, named \fB@RUNDIR@/\fItarget\fB.pid\fR.  (The \fB\-\-pidfile\fR
option makes an Open vSwitch daemon create a pidfile.)
\fBovs\-appctl\fR reads the pidfile, then looks for a Unix socket
named \fB@RUNDIR@/\fItarget\fB.\fIpid\fB.ctl\fR, where \fIpid\fR is
replaced by the process ID read from the pidfile, and uses that file
as if it had been specified directly as the target.
.IP
On Windows, \fItarget\fR can be an absolute path to a file that contains
a localhost TCP port on which an Open vSwitch daemon is listening
for control channel connections. By default, each daemon writes the
TCP port on which it is listening for control connection into the file
\fIprogram\fB.ctl\fR located inside the configured \fIOVS_RUNDIR\fR
directory. If \fItarget\fR is not an absolute path, \fBovs\-appctl\fR
looks for a file named \fItarget\fB.ctl\fR in the configured \fIOVS_RUNDIR\fR
directory.
.IP
The default target is \fBovs\-vswitchd\fR.
.
.IP "\fB\-T \fIsecs\fR"
.IQ "\fB\-\-timeout=\fIsecs\fR"
By default, or with a \fIsecs\fR of \fB0\fR, \fBovs\-appctl\fR waits
forever to connect to the daemon and receive a response.  This option
limits runtime to approximately \fIsecs\fR seconds.  If the timeout
expires, \fBovs\-appctl\fR exits with a \fBSIGALRM\fR signal.
.
.SH COMMON COMMANDS
Every Open vSwitch daemon supports a common set of commands, which are
documented in this section.
.
.SS GENERAL COMMANDS
These commands display daemon-specific commands and the running version.
Note that these commands are different from the \fB\-\-help\fR and
\fB\-\-version\fR options that return information about the
\fBovs\-appctl\fR utility itself.
.
.IP "\fBlist-commands\fR"
Lists the commands supported by the target.
.
.IP "\fBversion\fR"
Displays the version and compilation date of the target.
.
.SS LOGGING COMMANDS
Open vSwitch has several log levels.  The highest-severity log level is:
.
.IP "\fBoff\fR"
No message is ever logged at this level, so setting a logging
destination's log level to \fBoff\fR disables logging to that destination.
.
.PP
The following log levels, in order of descending severity, are
available:
.
.IP "\fBemer\fR"
A major failure forced a process to abort.
.IP "\fBerr\fR"
A high-level operation or a subsystem failed.  Attention is
warranted.
.IP "\fBwarn\fR"
A low-level operation failed, but higher-level subsystems may be able
to recover.
.IP "\fBinfo\fR"
Information that may be useful in retrospect when investigating
a problem.
.IP "\fBdbg\fR"
Information useful only to someone with intricate knowledge of the
system, or that would commonly cause too-voluminous log output.  Log
messages at this level are not logged by default.
.
.PP
Every Open vSwitch daemon supports the following commands for examining
and adjusting log levels.
.IP "\fBvlog/list\fR"
Lists the known logging modules and their current levels.
.
.IP "\fBvlog/list-pattern\fR"
Lists logging pattern used for each destination.
.
.IP "\fBvlog/set\fR [\fIspec\fR]"
Sets logging levels.  Without any \fIspec\fR, sets the log level for
every module and destination to \fBdbg\fR.  Otherwise, \fIspec\fR is a
list of words separated by spaces or commas or colons, up to one from
each category below:
.
.RS
.IP \(bu
A valid module name, as displayed by the \fBvlog/list\fR command on
\fBovs\-appctl\fR(8), limits the log level change to the specified
module.
.
.IP \(bu
\fBsyslog\fR, \fBconsole\fR, or \fBfile\fR, to limit the log level
change to only to the system log, to the console, or to a file,
respectively.
.IP
On Windows platform, \fBsyslog\fR is accepted as a word and
is only useful if the \fItarget\fR was started with the
\fB\-\-syslog\-target\fR option (the word has no effect otherwise).
.
.IP \(bu 
\fBoff\fR, \fBemer\fR, \fBerr\fR, \fBwarn\fR, \fBinfo\fR, or
\fBdbg\fR, to control the log level.  Messages of the given severity
or higher will be logged, and messages of lower severity will be
filtered out.  \fBoff\fR filters out all messages.
.RE
.
.IP
Case is not significant within \fIspec\fR.
.IP
Regardless of the log levels set for \fBfile\fR, logging to a file
will not take place unless the target application was invoked with the
\fB\-\-log\-file\fR option.
.IP
For compatibility with older versions of OVS, \fBany\fR is accepted as
a word but has no effect.
.
.IP "\fBvlog/set PATTERN:\fIdestination\fB:\fIpattern\fR"
Sets the log pattern for \fIdestination\fR to \fIpattern\fR.  Each time a
message is logged to \fIdestination\fR, \fIpattern\fR determines the
message's formatting.  Most characters in \fIpattern\fR are copied
literally to the log, but special escapes beginning with \fB%\fR are
expanded as follows:
.
.RS
.IP \fB%A\fR
The name of the application logging the message, e.g. \fBovs\-vswitchd\fR.
.
.IP \fB%B\fR
The RFC5424 syslog PRI of the message.
.
.IP \fB%c\fR
The name of the module (as shown by \fBovs\-appctl \-\-list\fR) logging
the message.
.
.IP \fB%d\fR
The current date and time in ISO 8601 format (YYYY\-MM\-DD HH:MM:SS).
.
.IP \fB%d{\fIformat\fB}\fR
The current date and time in the specified \fIformat\fR, which takes
the same format as the \fItemplate\fR argument to \fBstrftime\fR(3).
As an extension, any \fB#\fR characters in \fIformat\fR will be
replaced by fractional seconds, e.g. use \fB%H:%M:%S.###\fR for the
time to the nearest millisecond.  Sub-second times are only
approximate and currently decimal places after the third will always
be reported as zero.
.
.IP \fB%D\fR
The current UTC date and time in ISO 8601 format (YYYY\-MM\-DD HH:MM:SS).
.
.IP \fB%D{\fIformat\fB}\fR
The current UTC date and time in the specified \fIformat\fR, which
takes the same format as the \fItemplate\fR argument to
\fBstrftime\fR(3).  Supports the same extension for sub-second
resolution as \fB%d{\fR...\fB}\fR.
.
.IP \fB%E\fR
The hostname of the node running the application.
.
.IP \fB%m\fR
The message being logged.
.
.IP \fB%N\fR
A serial number for this message within this run of the program, as a
decimal number.  The first message a program logs has serial number 1,
the second one has serial number 2, and so on.
.
.IP \fB%n\fR
A new-line.
.
.IP \fB%p\fR
The level at which the message is logged, e.g. \fBDBG\fR.
.
.IP \fB%P\fR
The program's process ID (pid), as a decimal number.
.
.IP \fB%r\fR
The number of milliseconds elapsed from the start of the application
to the time the message was logged.
.
.IP \fB%t\fR
The subprogram name, that is, an identifying name for the process or
thread that emitted the log message, such as \fBmonitor\fR for the
process used for \fB\-\-monitor\fR or \fBmain\fR for the primary
process or thread in a program.
.
.IP \fB%T\fR
The subprogram name enclosed in parentheses, e.g. \fB(monitor)\fR, or
the empty string for the primary process or thread in a program.
.
.IP \fB%%\fR
A literal \fB%\fR.
.RE
.
.IP
A few options may appear between the \fB%\fR and the format specifier
character, in this order:
.
.RS
.IP \fB\-\fR
Left justify the escape's expansion within its field width.  Right
justification is the default.
.
.IP \fB0\fR
Pad the field to the field width with \fB0\fRs.  Padding with spaces
is the default.
.
.IP \fIwidth\fR
A number specifies the minimum field width.  If the escape expands to
fewer characters than \fIwidth\fR then it is padded to fill the field
width.  (A field wider than \fIwidth\fR is not truncated to fit.)
.RE
.
.IP
The default pattern for console and file output is \fB%D{%Y-%m-%dT
%H:%M:%SZ}|%05N|%c|%p|%m\fR; for syslog output, \fB%05N|%c|%p|%m\fR.
.
.IP
Daemons written in Python (e.g. \fBovs\-xapi\-sync\fR) do not allow
control over the log pattern.
.
.IP "\fBvlog/set\fR FACILITY:\fIfacility\fR"
Sets the RFC5424 facility of the log message. \fIfacility\fR can be one of
\fBkern\fR, \fBuser\fR, \fBmail\fR, \fBdaemon\fR, \fBauth\fR, \fBsyslog\fR,
\fBlpr\fR, \fBnews\fR, \fBuucp\fR, \fBclock\fR, \fBftp\fR, \fBntp\fR,
\fBaudit\fR, \fBalert\fR, \fBclock2\fR, \fBlocal0\fR, \fBlocal1\fR,
\fBlocal2\fR, \fBlocal3\fR, \fBlocal4\fR, \fBlocal5\fR, \fBlocal6\fR or
\fBlocal7\fR.
.
.IP "\fBvlog/close\fR"
Causes the daemon to close its log file, if it is open.  (Use
\fBvlog/reopen\fR to reopen it later.)
.
.IP "\fBvlog/reopen\fR"
Causes the daemon to close its log file, if it is open, and then
reopen it.  (This is useful after rotating log files, to cause a new
log file to be used.)
.IP
This has no effect if the target application was not invoked with the
\fB\-\-log\-file\fR option.
.
.SH OPTIONS
.
.so lib/common.man
.
.SH "SEE ALSO"
.
\fBovs\-appctl\fR can control all Open vSwitch daemons, including:
.BR ovs\-vswitchd (8),
and
.BR ovsdb\-server (8).
