Codebase list squidview / upstream/0.64
Imported Upstream version 0.64 Willi Mann 11 years ago
9 changed file(s) with 49 addition(s) and 29 deletion(s). Raw diff Collapse all Expand all
1212 and writing to a string that had been c_str() in another - pretty
1313 big coding mistakes if you ask me. Naughty boy etc.
1414
15 So the sorting should be fine now (provided I haven't coded other
16 errors) so please use the STL sort (for faster results too) and let
17 me know if it breaks for you: set "bRepMySort" to "no" and as I
18 previously explained:
15 For stability reasons my routines are still used, however this
16 is not the fastest solution. You can get about a 20% speed boost
17 if you set "bRepMySort" to "no", as I previously explained:
1918
2019 > There are two variables in squidview.conf which direct
2120 > sorting operations. "bRepMySort" can be set to "yes" to use
00 >> Squidview history:
1
2 v0.64: 17 February 2004:
3 - reverted back to stable, slower sort as a bug still lurks
4 - minor documentation fixes
15
26 v0.63: 17 December 2003:
37 - fixes to allow compiling in some environments
0 squidview 0.6 (c) 2001 - 2003 Graeme Sheppard - GPL software
0 squidview 0.6 (c) 2001 - 2004 Graeme Sheppard - GPL software
11 www.rillion.net/squidview
22
33 --Overview
2828 /usr/local/squid/var/logs/access.log
2929 If it isn't just symlink it appropriately from the following
3030 default. This directory and links are made in the user's home
31 space when first run by the user.
31 space when squidview is first run by the user.
3232
3333 graeme@localhost:~/.squidview$ ls -l
34 HOWTO -> /usr/local/share/doc/squidview/HOWTO
34 HOWTO -> /usr/local/share/squidview/HOWTO
3535 log1 -> /usr/local/squid/var/logs/access.log
3636 log2 -> log1
3737 log3 -> log1
3939 words
4040
4141 In this case squidview expects the primary log to be "log1",
42 and the symlink redirects it to where the file actually is.
43 The same thing applies to the readme.
42 and the symlink redirects it to where the file actually is. Three
43 log locations are supported which gives you a bit of room for
44 accomodating rotating logs.
4445
4546 This tar.gz archive comes with an example access.log named
46 example.log. Symlink it to view it with squidview.
47 example.log. Symlink it to view it with squidview, or copy it to
48 your ~/.squidview directory. The same applies to the HOWTO.
4749
4850 "users" and "words" are reporting files - these can be symlinks
4951 to /etc if you would rather have these files there. "aliases" is
0 squidview 0.60 (c) 2001 - 2003 Graeme Sheppard - GPL software
0 squidview 0.60 (c) 2001 - 2004 Graeme Sheppard - GPL software
11 www.rillion.net/squidview
22
33 --Overview
44
5 Squidview is a program meant to display the squid proxy server log
5 Squidview is a program that displays the squid proxy server log
66 file in a nice fashion, providing the log file is in squid's
77 native reporting fashion. It has features such as search, report
88 generation, monitor mode and supports three log files.
1212 this program is not a proactive resource controller. What it can
1313 do is tell you who and which sites are consuming the most bandwidth.
1414
15 First time users should read INSTALL and HOWTO.
16
1517 You will need the ncurses library.
693693
694694 PACKAGE=squidview
695695
696 VERSION=0.63
696 VERSION=0.64
697697
698698 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
699699 { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
00 AC_INIT(squidview.cpp)
11 AM_CONFIG_HEADER(config.h)
2 AM_INIT_AUTOMAKE(squidview,0.63)
2 AM_INIT_AUTOMAKE(squidview,0.64)
33 AC_PROG_CXX
44 AC_PROG_INSTALL
55
1616
1717 A program to nicely browse your squid log
1818
19 (c) 2001, 2002, 2003 Graeme Sheppard
19 (c) 2001 - 2004 Graeme Sheppard
2020
2121 This program is not how it would be if I had to rewrite it from scratch.
2222 It started off very simple (quick and nasty) and needed to be fast because
212212 if (snprintf (szTemp, sizeof (szTemp), "%d", iNumber) < 0)
213213 return "0";
214214 sReturn = szTemp;
215
215216 return sReturn;
216217 }
217218
227228 return "0";
228229
229230 sReturn = szTemp;
231
230232 iIndex = sReturn.length();
231233 if (iIndex == 0)
232234 return sReturn;
14911493 }
14921494
14931495
1494 string PosToTime (tFilePos iCurrent)
1496 // get the request's time out of it
1497 string RequestToTime (const char* szRequest)
14951498 {
14961499 string sTime;
14971500 time_t iTime;
14991502 if (iLogFileSize == 0)
15001503 return "";
15011504
1502 GetLine (iCurrent);
1503 if (NullText (pcReqBuff))
1505 if (NullText (szRequest))
15041506 return "";
15051507
1506 iTime = GetTimeNumber (pcReqBuff);
1508 iTime = GetTimeNumber (szRequest);
15071509 CalcTime (iTime, sTime);
15081510 RemoveSeconds (sTime);
15091511 return sTime;
1512 }
1513
1514
1515 // get the time from an arbitary point in log file
1516 string FilePosToTime (tFilePos iCurrent)
1517 {
1518 if (iLogFileSize == 0)
1519 return "";
1520
1521 GetLine (iCurrent);
1522 return RequestToTime (pcReqBuff);
15101523 }
15111524
15121525
15231536 if (iRepStart == 0)
15241537 sTemp1 = "begining of log";
15251538 else
1526 sTemp1 = PosToTime (iRepStart);
1539 sTemp1 = FilePosToTime (iRepStart);
15271540
15281541 if (iRepEnd == 0)
15291542 sTemp2 = "end of log";
15301543 else
1531 sTemp2 = PosToTime (iRepEnd);
1544 sTemp2 = FilePosToTime (iRepEnd);
15321545
15331546 switch (iRepWordHits)
15341547 {
19721985 EraseStatusLine();
19731986 refresh();
19741987 printf ("%s\r", sText.c_str());
1975 ShowHighLightMessage (sStatusLine);
1988 ShowHighLightMessage (sStatusLine); /// don't like this bit
19761989 }
19771990
19781991 if (fwrite (sText.c_str(), 1, sText.length(), fOutput) != sText.length())
21292142 if (sRepTitle != "")
21302143 WriteReportLine (sRepTitle + "\n\n");
21312144
2132 sTemp = PosToTime (iCurrent);
2145 sTemp = FilePosToTime (iCurrent);
21332146 if (iRepEnd == 0)
2134 sTemp2 = PosToTime (iLastPage);
2147 sTemp2 = FilePosToTime (iLastPage);
21352148 else
2136 sTemp2 = PosToTime (iRepEnd);
2149 sTemp2 = FilePosToTime (iRepEnd);
21372150
21382151 if (sTemp2 == sTemp)
21392152 WriteReportLine ("For " + sTemp + "\n\n");
45104523 CalcPercentage (iLinePos, iLastLinePos, sTemp);
45114524 NoLeadingSpaces (sTemp);
45124525 con << "All Users' Tally Mode\n\nCurrent position is "
4513 << PosToTime (iRepStart)
4526 << FilePosToTime (iRepStart)
45144527 << " (" << sTemp << ")\n\nPress enter to begin from here.\n\n"
45154528 << "Note this might take a while.";
45164529 iKey = getch();
52475260 void Help()
52485261 {
52495262 MyCls();
5250 con << PACKAGE << " " << VERSION << ": (c) " << "2001-2003"
5263 con << PACKAGE << " " << VERSION << ": (c) " << "2001-2004"
52515264 << " Graeme Sheppard - GPL software\n"
52525265 << "www.rillion.net/squidview\n\n" <<
52535266 "Keystrokes:-\n\n"
1616
1717 A program to nicely browse your squid log
1818
19 (c) 2001, 2002, 2003 Graeme Sheppard
19 (c) 2001 - 2004 Graeme Sheppard
2020
2121 */
2222
155155 bool bLookupIP = true;
156156 bool bAliases = false;
157157 int iRepFast = 10000;
158 bool bRepMySort = false;
158 bool bRepMySort = true;
159159
160160 struct sRecordPointer
161161 {