Commit 1bec84c2 authored by Geoff Simmons's avatar Geoff Simmons

add the -l option

parent 46aac195
......@@ -7,7 +7,7 @@ Display Varnish log contents in formats for client, backend and other events
----------------------------------------------------------------------------
:Author: Geoffrey Simmons
:Date: 2015-04-22
:Date: 2016-12-06
:Version: 4.0
:Manual section: 1
......@@ -15,9 +15,12 @@ Display Varnish log contents in formats for client, backend and other events
SYNOPSIS
========
varnishevent [-a] [-d] [-D] [-f configfile] [-F format] [-g grouping]
[-L txlimit] [-n varnish_name] [-N vsmfile] [-P file]
[-q query] [-r file] [-T txtimeout] [-v] [-V] [-w file]
::
varnishevent [-a] [-d] [-D] [-f configfile] [-F format] [-g grouping]
[-L txlimit] [-n varnish_name] [-N vsmfile] [-P file]
[-q query] [-r file] [-T txtimeout] [-v] [-V] [-w file]
[-l logfile]
DESCRIPTION
......@@ -77,6 +80,11 @@ OPTIONS
Print program usage and exit
-l logfile
Write the application log to ``logfile``. By default,
syslog(3) is used.
-L limit
Sets the upper limit of incomplete transactions kept before
......@@ -403,7 +411,7 @@ Parameter CLI Option Description
``max.reclen`` The maximum length of a Varnish log entry in characters. Should be equal to the Varnish 255 (default ``shm_reclen`` in Varnish 4)
parameter ``shm_reclen``.
---------------------- ---------- ----------------------------------------------------------------------------------------- -------
``log.file`` Log file for status, warning, debug and error messages, and monitoring statistics. If '-' ``syslog(3)``
``log.file`` ``-l`` Log file for status, warning, debug and error messages, and monitoring statistics. If '-' ``syslog(3)``
is specified, then log messages are written to stdout.
---------------------- ---------- ----------------------------------------------------------------------------------------- -------
``monitor.interval`` Interval in seconds at which monitoring statistics are emitted to the log (either 30
......
......@@ -550,7 +550,8 @@ usage(int status)
"usage: varnishevent [-adDhvV] [-f configfile] [-F format]\n"
" [-g grouping] [-L txlimit] [-n name] \n"
" [-N vsmfile] [-P pidfile] [-q query] \n"
" [-r binlog] [-T txtimeout] [-w outputfile]\n");
" [-r binlog] [-T txtimeout] [-w outputfile]\n"
" [-l logfile]\n");
exit(status);
}
......@@ -559,7 +560,7 @@ main(int argc, char *argv[])
{
int c, errnum, status, a_flag = 0, v_flag = 0, d_flag = 0, D_flag = 0;
char *P_arg = NULL, *w_arg = NULL, *q_arg = NULL, *g_arg = NULL,
*n_arg = NULL, *N_arg = NULL, scratch[BUFSIZ];
*n_arg = NULL, *N_arg = NULL, *l_arg = NULL, scratch[BUFSIZ];
char cli_config_filename[PATH_MAX + 1] = "";
struct vpf_fh *pfh = NULL;
struct VSL_data *vsl;
......@@ -575,7 +576,7 @@ main(int argc, char *argv[])
CONF_Init();
read_default_config();
while ((c = getopt(argc, argv, "adDhvVP:w:F:g:f:q:r:n:N:L:T:")) != -1) {
while ((c = getopt(argc, argv, "adDhvVP:w:F:g:f:q:r:n:N:L:T:l:")) != -1) {
switch (c) {
case 'a':
a_flag = 1;
......@@ -624,6 +625,9 @@ main(int argc, char *argv[])
}
bprintf(cli_config_filename, "%s", optarg);
break;
case 'l':
REPLACE(l_arg, optarg);
break;
case 'q':
REPLACE(q_arg, optarg);
break;
......@@ -689,6 +693,8 @@ main(int argc, char *argv[])
}
#endif
if (l_arg != NULL)
bprintf(config.log_file, "%s", l_arg);
if (LOG_Open(VSB_data(config.syslog_ident)) != 0) {
exit(EXIT_FAILURE);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment