]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Sort the top sites report by number of users connecting the sites
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Mon, 16 Jul 2012 10:19:34 +0000 (12:19 +0200)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Mon, 16 Jul 2012 10:19:34 +0000 (12:19 +0200)
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
include/conf.h
sarg.conf
topsites.c

index e338310323e31dd5ef8db61fb64f76154be2ce49..65b8769edc679aeed719909b52dc8ac32e9882e4 100644 (file)
--- 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[]=
index 70cb4a2fc67903fd376fe52b3a7b703d6e193ee4..34b63899453448c4c92fa36d0606103c229ed81d 100755 (executable)
@@ -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
index 52c83f349c91e53adf66afd6b570b30d5c8b3735..9b3ccc6b3c555845f74764d596de907c072b9d23 100644 (file)
--- a/sarg.conf
+++ b/sarg.conf
 #
 #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
index 7579016aa857f02959b32694af1b1c16387910e4..01ef7fdb0ec6fe32b89b42f5441d541891ca1a13 100644 (file)
@@ -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
        }