From 7d82ea1abba367989fdcb1258de65e089b4ef090 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Marchal?= Date: Mon, 16 Jul 2012 12:19:34 +0200 Subject: [PATCH] Sort the top sites report by number of users connecting the sites The top sites report can be sorted according to the number of users connecting to the visited sites. It shows how popular sites are within your network. --- getconf.c | 1 + include/conf.h | 1 + sarg.conf | 2 +- topsites.c | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/getconf.c b/getconf.c index e338310..65b8769 100644 --- a/getconf.c +++ b/getconf.c @@ -174,6 +174,7 @@ struct sort_list topsite_sort[]= {"BYTES",TOPSITE_SORT_BYTES}, {"CONNECT",TOPSITE_SORT_CONNECT}, {"TIME",TOPSITE_SORT_TIME}, + {"USER",TOPSITE_SORT_USER}, }; struct sort_list user_sort[]= diff --git a/include/conf.h b/include/conf.h index 70cb4a2..34b6389 100755 --- a/include/conf.h +++ b/include/conf.h @@ -265,6 +265,7 @@ Sarg will complain that there are too many days in the files if this limit is ov #define TOPSITE_SORT_BYTES 0x0002UL #define TOPSITE_SORT_CONNECT 0x0004UL #define TOPSITE_SORT_TIME 0x0008UL +#define TOPSITE_SORT_USER 0x0010UL #define USER_SORT_REVERSE SORT_REVERSE #define USER_SORT_BYTES 0x0002UL diff --git a/sarg.conf b/sarg.conf index 52c83f3..9b3ccc6 100644 --- a/sarg.conf +++ b/sarg.conf @@ -293,7 +293,7 @@ # #topsites_num 100 -# TAG: topsites_sort_order CONNECT|BYTES|TIME A|D +# TAG: topsites_sort_order CONNECT|BYTES|TIME|USER A|D # Sort for topsites report, where A=Ascendent, D=Descendent # #topsites_sort_order CONNECT D diff --git a/topsites.c b/topsites.c index 7579016..01ef7fd 100644 --- a/topsites.c +++ b/topsites.c @@ -192,6 +192,8 @@ void topsites(void) sortf="-k 2,2 -k 1,1"; } else if((TopsitesSort & TOPSITE_SORT_TIME) != 0) { sortf="-k 3,3"; + } else if((TopsitesSort & TOPSITE_SORT_USER) != 0) { + sortf="-k 4,4 -k 1,1 -k 2,2"; } else { sortf="-k 2,2 -k 1,1"; //default is BYTES } -- 2.47.2