Imported Upstream version 0.67
Willi Mann
11 years ago
0 | 0 | >> 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 | |
1 | 10 | |
2 | 11 | v0.65: 29 February 2004: |
3 | 12 | - faster runs of external programs - help here from Willi Mann of |
0 | 0 | bin_PROGRAMS = squidview |
1 | 1 | squidview_SOURCES = squidview.cpp squidview.h |
2 | 2 | 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 |
64 | 64 | bin_PROGRAMS = squidview |
65 | 65 | squidview_SOURCES = squidview.cpp squidview.h |
66 | 66 | 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 | |
68 | 69 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
69 | 70 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs |
70 | 71 | CONFIG_HEADER = config.h |
88 | 89 | COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
89 | 90 | CCLD = $(CC) |
90 | 91 | LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ |
92 | man1dir = $(mandir)/man1 | |
93 | MANS = $(man_MANS) | |
94 | ||
95 | NROFF = nroff | |
91 | 96 | DATA = $(pkgdata_DATA) |
92 | 97 | |
93 | 98 | DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ |
197 | 202 | $(CXXLINK) $(squidview_LDFLAGS) $(squidview_OBJECTS) $(squidview_LDADD) $(LIBS) |
198 | 203 | .cpp.o: |
199 | 204 | $(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 | |
200 | 244 | |
201 | 245 | install-pkgdataDATA: $(pkgdata_DATA) |
202 | 246 | @$(NORMAL_INSTALL) |
310 | 354 | install-exec-am: install-binPROGRAMS |
311 | 355 | install-exec: install-exec-am |
312 | 356 | |
313 | install-data-am: install-pkgdataDATA | |
357 | install-data-am: install-man install-pkgdataDATA | |
314 | 358 | install-data: install-data-am |
315 | 359 | |
316 | 360 | install-am: all-am |
317 | 361 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am |
318 | 362 | install: install-am |
319 | uninstall-am: uninstall-binPROGRAMS uninstall-pkgdataDATA | |
363 | uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall-pkgdataDATA | |
320 | 364 | uninstall: uninstall-am |
321 | all-am: Makefile $(PROGRAMS) $(DATA) config.h | |
365 | all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h | |
322 | 366 | all-redirect: all-am |
323 | 367 | install-strip: |
324 | 368 | $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install |
325 | 369 | installdirs: |
326 | $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(pkgdatadir) | |
370 | $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 \ | |
371 | $(DESTDIR)$(pkgdatadir) | |
327 | 372 | |
328 | 373 | |
329 | 374 | mostlyclean-generic: |
365 | 410 | mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ |
366 | 411 | maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ |
367 | 412 | 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 \ | |
369 | 415 | mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \ |
370 | 416 | distdir info-am info dvi-am dvi check check-am installcheck-am \ |
371 | 417 | installcheck all-recursive-am install-exec-am install-exec \ |
693 | 693 | |
694 | 694 | PACKAGE=squidview |
695 | 695 | |
696 | VERSION=0.65 | |
696 | VERSION=0.67 | |
697 | 697 | |
698 | 698 | if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then |
699 | 699 | { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } |
0 | 0 | AC_INIT(squidview.cpp) |
1 | 1 | AM_CONFIG_HEADER(config.h) |
2 | AM_INIT_AUTOMAKE(squidview,0.65) | |
2 | AM_INIT_AUTOMAKE(squidview,0.67) | |
3 | 3 | AC_PROG_CXX |
4 | 4 | AC_PROG_INSTALL |
5 | 5 |
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). |
174 | 174 | /// execute a shell command |
175 | 175 | void RunProgram(const string& sCommand) |
176 | 176 | { |
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 | ||
196 | 177 | MyCls(); |
197 | 178 | curs_set (1); |
198 | 179 | echo(); |
199 | 180 | nocbreak(); |
200 | if (wTemp) | |
201 | endwin(); // suggested by endwin(3) | |
181 | endwin(); // suggested by endwin(3) | |
202 | 182 | system (sCommand.c_str()); |
203 | 183 | keypad (stdscr, TRUE); |
204 | 184 | curs_set (0); |
406 | 386 | string sTemp; |
407 | 387 | |
408 | 388 | CalcPercentage (iPos, iMax, sTemp); |
409 | sTemp += string (" ") + szText + " | <s> to abort"; | |
389 | sTemp += string (" ") + szText + " | <s> to stop"; | |
410 | 390 | ShowHighLightMessage (sTemp); |
411 | 391 | } |
412 | 392 | |
3124 | 3104 | |
3125 | 3105 | case 'l': |
3126 | 3106 | sTemp = "( cd " + sPathToFiles + " ; " + |
3127 | "echo -e \"Current reports:-\n\" ; " + | |
3107 | "echo -e \"Current reports:\n\" ; " + | |
3128 | 3108 | "ls -l *" + sReportExt + " ) | " + sViewer; |
3129 | 3109 | RunProgram (sTemp); |
3130 | 3110 | break; |
3232 | 3212 | if (bGood) |
3233 | 3213 | { |
3234 | 3214 | sRepFilter = sDest; |
3235 | con << "\n\nReport " + sDest + " made: view?"; | |
3215 | con << "\n\nReport " + sDest + " made: view (y/n)?"; | |
3236 | 3216 | if (getch() == 'y') |
3237 | 3217 | { |
3238 | 3218 | sTemp = sViewer + " " + sPathToFiles + "/" + sDest; |
5409 | 5389 | struct stat sStatTable; |
5410 | 5390 | char* szTemp; |
5411 | 5391 | int iTemp; |
5412 | string sLog1, sLog2, sLog3, sHowToFile; | |
5392 | string sLog1, sLog2, sLog3, sHowToFile, sLogLocation; | |
5413 | 5393 | |
5414 | 5394 | szTemp = getenv ("HOME"); |
5415 | 5395 | if (szTemp == 0) |
5435 | 5415 | return; |
5436 | 5416 | |
5437 | 5417 | printf ("Making .squidview directory and links....\n"); |
5418 | ||
5419 | sLogLocation = ""; | |
5420 | for (iTemp = 0; iTemp < int (sizeof (sLogLocations)); iTemp++) | |
5421 | if (GetFileSize (sLogLocations [iTemp]) > 0) | |
5422 | { | |
5423 | sLogLocation = sLogLocations [iTemp]; | |
5424 | break; | |
5425 | } | |
5426 | if (sLogLocation == "") | |
5427 | sLogLocation = sLogLocations [0]; | |
5428 | ||
5438 | 5429 | iTemp = 0; |
5439 | 5430 | for (;;) |
5440 | 5431 | { |
5441 | 5432 | if (mkdir (sPathToFiles.c_str(), 0755)) break; |
5442 | if (symlink (szMainLog, sLogFile1.c_str())) break; | |
5433 | if (symlink (sLogLocation.c_str(), sLogFile1.c_str())) break; | |
5443 | 5434 | if (symlink (szLog1, sLogFile2.c_str())) break; |
5444 | 5435 | if (symlink (szLog1, sLogFile3.c_str())) break; |
5445 | 5436 | if (symlink (sHowToFile.c_str(), sHowToLink.c_str())) break; |
5454 | 5445 | if (GetFileSize (sLogFile1) <= 0) |
5455 | 5446 | { |
5456 | 5447 | printf ("The squid log file doesn't exist or is of zero size.\n"); |
5457 | printf ("You may need to manually adjust the symlinks in .squidview\n"); | |
5448 | printf ("You may need to manually adjust the symlinks in ~/.squidview\n"); | |
5458 | 5449 | exit (1); |
5459 | 5450 | } |
5460 | 5451 | } |
12 | 12 | * along with this program; if not, write to the Free Software |
13 | 13 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
14 | 14 | |
15 | squidview 0.51 | |
15 | squidview 0.6 | |
16 | 16 | |
17 | 17 | A program to nicely browse your squid log |
18 | 18 | |
62 | 62 | string sHomeDir; |
63 | 63 | const char szSquidHome[] = ".squidview"; |
64 | 64 | string sPathToFiles; |
65 | const char szMainLog[] = "/usr/local/squid/var/logs/access.log"; | |
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 | |
66 | 68 | |
67 | 69 | const char szLog1[] = "log1"; |
68 | 70 | const char szLog2[] = "log2"; |