From: Frédéric Marchal Date: Mon, 16 Jul 2012 10:19:34 +0000 (+0200) Subject: Sort the top sites report by number of users connecting the sites X-Git-Tag: v2.3.3~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d82ea1abba367989fdcb1258de65e089b4ef090;p=thirdparty%2Fsarg.git 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. --- 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 }