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