Codebase list squidview / b323a1e
Imported Debian patch 0.67-1 Willi Mann 11 years ago
12 changed file(s) with 179 addition(s) and 101 deletion(s). Raw diff Collapse all Expand all
00 >> Squidview history:
1
2 v0.67: 5 March 2004
3 - endwin() goes back in
4
5 v0.66: 4 March 2004:
6 - tries to guess squid log file location (at first run)
7 - disabled endwin(3) in RunProgram because a report said it messed up a
8 terminal
9 - Debian provided man page added - thanks Willi Mann
110
211 v0.65: 29 February 2004:
312 - faster runs of external programs - help here from Willi Mann of
00 bin_PROGRAMS = squidview
11 squidview_SOURCES = squidview.cpp squidview.h
22 pkgdata_DATA = HOWTO BUGS users words aliases example.log
3 EXTRA_DIST = Makefile.old HOWTO BUGS users words aliases example.log
3 man_MANS = squidview.1
4 EXTRA_DIST = Makefile.old HOWTO BUGS $(man_MANS) users words aliases example.log
6464 bin_PROGRAMS = squidview
6565 squidview_SOURCES = squidview.cpp squidview.h
6666 pkgdata_DATA = HOWTO BUGS users words aliases example.log
67 EXTRA_DIST = Makefile.old HOWTO BUGS users words aliases example.log
67 man_MANS = squidview.1
68 EXTRA_DIST = Makefile.old HOWTO BUGS $(man_MANS) users words aliases example.log
6869 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
6970 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
7071 CONFIG_HEADER = config.h
8889 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
8990 CCLD = $(CC)
9091 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
92 man1dir = $(mandir)/man1
93 MANS = $(man_MANS)
94
95 NROFF = nroff
9196 DATA = $(pkgdata_DATA)
9297
9398 DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
197202 $(CXXLINK) $(squidview_LDFLAGS) $(squidview_OBJECTS) $(squidview_LDADD) $(LIBS)
198203 .cpp.o:
199204 $(CXXCOMPILE) -c $<
205
206 install-man1:
207 $(mkinstalldirs) $(DESTDIR)$(man1dir)
208 @list='$(man1_MANS)'; \
209 l2='$(man_MANS)'; for i in $$l2; do \
210 case "$$i" in \
211 *.1*) list="$$list $$i" ;; \
212 esac; \
213 done; \
214 for i in $$list; do \
215 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
216 else file=$$i; fi; \
217 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
218 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
219 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
220 echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
221 $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
222 done
223
224 uninstall-man1:
225 @list='$(man1_MANS)'; \
226 l2='$(man_MANS)'; for i in $$l2; do \
227 case "$$i" in \
228 *.1*) list="$$list $$i" ;; \
229 esac; \
230 done; \
231 for i in $$list; do \
232 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
233 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
234 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
235 echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
236 rm -f $(DESTDIR)$(man1dir)/$$inst; \
237 done
238 install-man: $(MANS)
239 @$(NORMAL_INSTALL)
240 $(MAKE) $(AM_MAKEFLAGS) install-man1
241 uninstall-man:
242 @$(NORMAL_UNINSTALL)
243 $(MAKE) $(AM_MAKEFLAGS) uninstall-man1
200244
201245 install-pkgdataDATA: $(pkgdata_DATA)
202246 @$(NORMAL_INSTALL)
310354 install-exec-am: install-binPROGRAMS
311355 install-exec: install-exec-am
312356
313 install-data-am: install-pkgdataDATA
357 install-data-am: install-man install-pkgdataDATA
314358 install-data: install-data-am
315359
316360 install-am: all-am
317361 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
318362 install: install-am
319 uninstall-am: uninstall-binPROGRAMS uninstall-pkgdataDATA
363 uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall-pkgdataDATA
320364 uninstall: uninstall-am
321 all-am: Makefile $(PROGRAMS) $(DATA) config.h
365 all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h
322366 all-redirect: all-am
323367 install-strip:
324368 $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
325369 installdirs:
326 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(pkgdatadir)
370 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 \
371 $(DESTDIR)$(pkgdatadir)
327372
328373
329374 mostlyclean-generic:
365410 mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
366411 maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
367412 mostlyclean-compile distclean-compile clean-compile \
368 maintainer-clean-compile uninstall-pkgdataDATA install-pkgdataDATA tags \
413 maintainer-clean-compile install-man1 uninstall-man1 install-man \
414 uninstall-man uninstall-pkgdataDATA install-pkgdataDATA tags \
369415 mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
370416 distdir info-am info dvi-am dvi check check-am installcheck-am \
371417 installcheck all-recursive-am install-exec-am install-exec \
693693
694694 PACKAGE=squidview
695695
696 VERSION=0.65
696 VERSION=0.67
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.65)
2 AM_INIT_AUTOMAKE(squidview,0.67)
33 AC_PROG_CXX
44 AC_PROG_INSTALL
55
0 squidview (0.67-1) unstable; urgency=low
1
2 * New upstream release
3 * Remove dependency on libstdc++-3.3-dev (thanks James Troup)
4 * Better short description (thanks Martin Schulze) (closes: #238147)
5 * CreateLinks():
6 - Fix a segfault in in new upstream release in CreateLinks().
7 sizeof() of an array with two elements is 8 (byte, on 32-bit systems)
8 -> The array now ends with an empty string and that's the new
9 termination condition of the for-loop.
10 - Give the user more information what went wrong and how to fix it.
11 - Add Debian-specific info to CreateLinks() for maximum comfort.
12 ifdef'd so it can be included upstream.
13 * Remove some unneccessary debhelper calls.
14
15 -- Willi Mann <willi@wm1.at> Tue, 16 Mar 2004 08:23:47 +0100
16
017 squidview (0.65-1) unstable; urgency=low
118
219 * New upstream release
11 Section: admin
22 Priority: optional
33 Maintainer: Willi Mann <willi@wm1.at>
4 Build-Depends: debhelper (>> 3.0.0), libncurses5-dev, libstdc++5-3.3-dev
4 Build-Depends: debhelper (>> 3.0.0), libncurses5-dev
55 Standards-Version: 3.6.1.0
66
77 Package: squidview
88 Architecture: any
99 Depends: ${shlibs:Depends}, less
10 Description: monitors and analyzes your squid's - access.log
10 Description: monitors and analyzes squid access.log files
1111 squidview is a ncurses-based application which allows you to view
1212 and monitor your squid's access.log in a very comfortable way.
1313 Additionally you can create reports and statistics.
1414 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
1515
1616 CXX = g++
17 CXXFLAGS = -Wall -g
17 CXXFLAGS = -Wall -g -DDEBIANIZED
1818 INSTALL = install
1919 INSTALL_FILE = $(INSTALL) -p -o root -g root -m 644
2020 INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755
8181 dh_testroot
8282 # dh_installdebconf
8383 dh_installdocs
84 dh_installexamples
85 dh_installmenu
84 # dh_installexamples
85 # dh_installmenu
8686 # dh_installlogrotate
8787 # dh_installemacsen
8888 # dh_installpam
8989 # dh_installmime
9090 # dh_installinit
91 dh_installcron
92 dh_installman debian/squidview.1
93 dh_installinfo
91 # dh_installcron
92 dh_installman
93 # dh_installinfo
9494 # dh_undocumented
9595 dh_installchangelogs ChangeLog
96 dh_link
96 # dh_link
9797 dh_strip
9898 dh_compress -XHOWTO
9999 dh_fixperms
+0
-50
debian/squidview.1 less more
0 .\" Hey, EMACS: -*- nroff -*-
1 .\" First parameter, NAME, should be all caps
2 .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
3 .\" other parameters are allowed: see man(7), man(1)
4 .TH SQUIDVIEW 1 "Feber 18, 2004"
5 .\" Please adjust this date whenever revising the manpage.
6 .\"
7 .\" Some roff macros, for reference:
8 .\" .nh disable hyphenation
9 .\" .hy enable hyphenation
10 .\" .ad l left justify
11 .\" .ad b justify to both left and right margins
12 .\" .nf disable filling
13 .\" .fi enable filling
14 .\" .br insert line break
15 .\" .sp <n> insert n+1 empty lines
16 .\" for manpage-specific macros, see man(7)
17 .SH NAME
18 squidview \- program to monitor your squid's access.log
19 .SH SYNOPSIS
20 .B squidview
21 .\".RI [ options ] " files" ...
22 .SH DESCRIPTION
23 This manual page documents briefly the
24 .B squidview
25 application.
26 This manual page was written for the Debian distribution
27 because the original program does not have a manual page.
28 Instead, it has a brief online help (Press "h").
29 .PP
30 .B squidview
31 is a ncurses-based application which allows you to view
32 and monitor your squid's access.log in a very comfortable way.
33 Additionally you can create reports and statistics.
34 .SH NOTES
35 .PP
36 .B Squidview
37 is configured by the contents of the directory ~/.squidview/.
38 On first execution it creates the neccessary files. The Debian-version has been
39 modified to match the default log-path of Debian's
40 .B squid
41 package
42 /var/log/squid/access.log). If you have the permission to read this file
43 (ie be in group proxy), squidview should work out of the box. If not, file a bug
44 against this package (squidview, obviously :-)).
45 .SH OPTIONS
46 This program ignores any command-line parameters.
47 .SH AUTHOR
48 This manual page was written by Willi Mann <willi@wm1.at>,
49 for the Debian GNU/Linux system (but may be used by others).
0 .\" Hey, EMACS: -*- nroff -*-
1 .\" First parameter, NAME, should be all caps
2 .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
3 .\" other parameters are allowed: see man(7), man(1)
4 .TH SQUIDVIEW 1 "Feber 18, 2004"
5 .\" Please adjust this date whenever revising the manpage.
6 .\"
7 .\" Some roff macros, for reference:
8 .\" .nh disable hyphenation
9 .\" .hy enable hyphenation
10 .\" .ad l left justify
11 .\" .ad b justify to both left and right margins
12 .\" .nf disable filling
13 .\" .fi enable filling
14 .\" .br insert line break
15 .\" .sp <n> insert n+1 empty lines
16 .\" for manpage-specific macros, see man(7)
17 .SH NAME
18 squidview \- program to monitor your squid's access.log
19 .SH SYNOPSIS
20 .B squidview
21 .\".RI [ options ] " files" ...
22 .SH DESCRIPTION
23 This manual page documents briefly the
24 .B squidview
25 application.
26 This manual page was written for the Debian distribution
27 because the original program does not have a manual page.
28 Instead, it has a brief online help (Press "h").
29 .PP
30 .B squidview
31 is a ncurses-based application which allows you to view
32 and monitor your squid's access.log in a very comfortable way.
33 Additionally you can create reports and statistics.
34 .SH NOTES
35 .PP
36 .B Squidview
37 is configured by the contents of the directory ~/.squidview/.
38 On first execution it creates the neccessary files. The Debian-version has been
39 modified to match the default log-path of Debian's
40 .B squid
41 package
42 /var/log/squid/access.log). If you have the permission to read this file
43 (ie be in group proxy), squidview should work out of the box. If not, file a bug
44 against this package (squidview, obviously :-)).
45 .SH OPTIONS
46 This program ignores any command-line parameters.
47 .SH AUTHOR
48 This manual page was written by Willi Mann <willi@wm1.at>,
49 for the Debian GNU/Linux system (but may be used by others).
174174 /// execute a shell command
175175 void RunProgram(const string& sCommand)
176176 {
177 //Debian - Notes: 1) "reset -Q" resets the size of my terminal (konsole).
178 //2) I don't believe "clear" is a proper way for this sort of
179 //terminal-cleaning.
180 //solution: use endwin() + refresh() + optionally (iWait) standard c++
181 //for waiting.
182 //This messes up the output in some rare cases with iErase == 0.
183 //Still readable, just not as intended. Additional note: In the
184 //original code first call of n,l didn't show anything
185 //reason not clear.
186 //Implementation of iWait was neccessary to keep the non-curses
187 //code in one function. Seems that any call to the curses library
188 //returns to curses mode, what would make it hard to keep the
189 //"Press any" key in the original place.
190
191 // clear(1) clears the user's bash console (squidview's parent), but this
192 // isn't necessary. And yes, MyCls() is much faster so now used. This bit
193 // of code has been simplified, and if all goes well these comments will
194 // be deleted.
195
196177 MyCls();
197178 curs_set (1);
198179 echo();
199180 nocbreak();
200 //This line doesn't seem to be needed; instead it
201 // caused another screen corruption. Hopefully there are no side effects.
202 // (I can't imagine one)
203 //--> if (wTemp)
204181 endwin(); // suggested by endwin(3)
205182 system (sCommand.c_str());
206183 keypad (stdscr, TRUE);
409386 string sTemp;
410387
411388 CalcPercentage (iPos, iMax, sTemp);
412 sTemp += string (" ") + szText + " | <s> to abort";
389 sTemp += string (" ") + szText + " | <s> to stop";
413390 ShowHighLightMessage (sTemp);
414391 }
415392
31273104
31283105 case 'l':
31293106 sTemp = "( cd " + sPathToFiles + " ; " +
3130 "echo -e \"Current reports:-\n\" ; " +
3107 "echo -e \"Current reports:\n\" ; " +
31313108 "ls -l *" + sReportExt + " ) | " + sViewer;
31323109 RunProgram (sTemp);
31333110 break;
32353212 if (bGood)
32363213 {
32373214 sRepFilter = sDest;
3238 //Debian-Note: Added (y/n) to be more intuitive
3239 con << "\n\nReport " + sDest + " made: view? (y/n)";
3215 con << "\n\nReport " + sDest + " made: view (y/n)?";
32403216 if (getch() == 'y')
32413217 {
32423218 sTemp = sViewer + " " + sPathToFiles + "/" + sDest;
54115387 void CreateLinks()
54125388 {
54135389 struct stat sStatTable;
5390 struct stat dummy;
54145391 char* szTemp;
54155392 int iTemp;
5416 string sLog1, sLog2, sLog3, sHowToFile;
5393 string sLog1, sLog2, sLog3, sHowToFile, sLogLocation;
54175394
54185395 szTemp = getenv ("HOME");
54195396 if (szTemp == 0)
54395416 return;
54405417
54415418 printf ("Making .squidview directory and links....\n");
5419
5420 sLogLocation = "";
5421 //Algorithm is: First find out if one of the list exists, if none
5422 //exists, take the first.
5423 //Debian note: 1) don't use sizeof(). It returns array length * pointer size.
5424 //require that the last element of sLogLocatations is "".
5425 //2) Check for file existence, not size. On low traffic sites it's very possible that
5426 //access.log is empty at first start of squidview (think of weekends).
5427 for (iTemp = 0; sLogLocations[iTemp] != ""; iTemp++)
5428 if (stat(sLogLocations[iTemp].c_str(), &dummy) == 0)
5429 {
5430 sLogLocation = sLogLocations [iTemp];
5431 break;
5432 }
5433 if (sLogLocation == "")
5434 sLogLocation = sLogLocations [0];
5435
54425436 iTemp = 0;
54435437 for (;;)
54445438 {
54455439 if (mkdir (sPathToFiles.c_str(), 0755)) break;
5446 if (symlink (szMainLog, sLogFile1.c_str())) break;
5440 if (symlink (sLogLocation.c_str(), sLogFile1.c_str())) break;
54475441 if (symlink (szLog1, sLogFile2.c_str())) break;
54485442 if (symlink (szLog1, sLogFile3.c_str())) break;
54495443 if (symlink (sHowToFile.c_str(), sHowToLink.c_str())) break;
54585452 if (GetFileSize (sLogFile1) <= 0)
54595453 {
54605454 printf ("The squid log file doesn't exist or is of zero size.\n");
5461 printf ("You may need to manually adjust the symlinks in .squidview\n");
5462 exit (1);
5455 printf ("You may need to manually adjust the symlinks in ~/.squidview\n");
5456 printf ("It was assumed that your access.log is at %s\n", sLogLocation.c_str());
5457
5458 //Don't exit if logfile is empty but does exist.
5459 if(stat(sLogLocation.c_str(), &dummy) != 0)
5460 {
5461 #ifdef DEBIANIZED
5462 printf ("You may want to add your username to the group proxy.\n");
5463 #endif
5464 exit (1);
5465 }
54635466 }
54645467 }
54655468
1212 * along with this program; if not, write to the Free Software
1313 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1414
15 squidview 0.51
15 squidview 0.6
1616
1717 A program to nicely browse your squid log
1818
6262 string sHomeDir;
6363 const char szSquidHome[] = ".squidview";
6464 string sPathToFiles;
65 const char szMainLog[] = "/var/log/squid/access.log"; //Default path in Debian squid-package
65 const string sLogLocations[] = {"/var/log/squid/access.log",
66 "/usr/local/squid/var/logs/access.log", ""};
67 // disribution builders: put your log location first in the list
6668
6769 const char szLog1[] = "log1";
6870 const char szLog2[] = "log2";