Commit 4e7def9f authored by Tollef Fog Heen's avatar Tollef Fog Heen

Group requests by default in varnishlog

Add -O option to turn off grouping.

Get rid of blank line separating requests.
parent 62764cac
......@@ -65,7 +65,7 @@ h_order_finish(int fd, struct VSM_data *vd)
AZ(vsb_finish(ob[fd]));
if (vsb_len(ob[fd]) > 1 && VSL_Matched(vd, bitmap[fd])) {
printf("%s\n", vsb_data(ob[fd]));
printf("%s", vsb_data(ob[fd]));
}
bitmap[fd] = 0;
vsb_clear(ob[fd]);
......@@ -274,7 +274,7 @@ int
main(int argc, char * const *argv)
{
int c;
int a_flag = 0, D_flag = 0, o_flag = 0, u_flag = 0;
int a_flag = 0, D_flag = 0, O_flag = 0, u_flag = 0, m_flag = 0;
const char *P_arg = NULL;
const char *w_arg = NULL;
struct pidfh *pfh = NULL;
......@@ -283,7 +283,7 @@ main(int argc, char * const *argv)
vd = VSM_New();
VSL_Setup(vd);
while ((c = getopt(argc, argv, VSL_ARGS "aDP:uVw:")) != -1) {
while ((c = getopt(argc, argv, VSL_ARGS "aDP:uVw:oO")) != -1) {
switch (c) {
case 'a':
a_flag = 1;
......@@ -299,9 +299,10 @@ main(int argc, char * const *argv)
case 'D':
D_flag = 1;
break;
case 'o':
o_flag = 1;
AN(VSL_Arg(vd, c, optarg));
case 'o': /* ignored for compatibility with older versions */
break;
case 'O':
O_flag = 1;
break;
case 'P':
P_arg = optarg;
......@@ -316,7 +317,7 @@ main(int argc, char * const *argv)
w_arg = optarg;
break;
case 'm':
o_flag = 1; /* fall through */
m_flag = 1; /* fall through */
default:
if (VSL_Arg(vd, c, optarg) > 0)
break;
......@@ -324,10 +325,10 @@ main(int argc, char * const *argv)
}
}
if (o_flag && w_arg != NULL)
if (O_flag && m_flag)
usage();
if ((argc - optind) > 0 && !o_flag)
if ((argc - optind) > 0)
usage();
if (VSL_Open(vd, 1))
......@@ -354,7 +355,7 @@ main(int argc, char * const *argv)
if (u_flag)
setbuf(stdout, NULL);
if (o_flag)
if (!O_flag)
do_order(vd);
while (VSL_Dispatch(vd, VSL_H_Print, stdout) >= 0) {
......
......@@ -17,7 +17,7 @@ SYNOPSIS
========
varnishlog [-a] [-b] [-C] [-c] [-D] [-d] [-I regex] [-i tag] [-k keep]
[-n varnish_name] [-o] [-m tag:regex ...] [-P file] [-r file] [-s num] [-u] [-V]
[-n varnish_name] [-o] [-O] [-m tag:regex ...] [-P file] [-r file] [-s num] [-u] [-V]
[-w file] [-X regex] [-x tag]
DESCRIPTION
......@@ -52,13 +52,15 @@ The following options are available:
-k num Only show the first num log records.
-m tag:regex only list transactions where tag matches regex. Multiple
-m options are AND-ed together.
-m options are AND-ed together. Can not be combined with -O
-n Specifies the name of the varnishd instance to get logs from. If -n is not
specified, the host name is used.
-o Group log entries by request ID. This has no effect when writing to a
file using the -w option.
-o Ignored for compatibility with earlier versions.
-O Do not group log entries by request ID. Can not be
combined with -m.
-P file Write the process's PID to the specified file.
......
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