Package: logtools Version: 0.13d Severity: normal Tags: patch Hi,
We're processing several GB of logs daily with clfmerge, thanks for the useful tool! However one problem: the logs daily contain say one or two truncated lines which trigger a "Skipping bad line" warning. We're really missing a way to ignore this - now we get daily cron spam about this while it's not a problem. I've implemented attached 'verbose' option, which only outputs that warning when -v is passed to clfmerge. Would you be willing to apply it? (BTW: I encountered some deprecation and lintian warnings while building the package which you may want to look into.) thanks, Thijs -- System Information: Debian Release: 6.0.4 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash
diff -Nru logtools-0.13d/changes.txt logtools-0.13d+uvt1/changes.txt --- logtools-0.13d/changes.txt 2008-06-06 07:35:00.000000000 +0200 +++ logtools-0.13d+uvt1/changes.txt 2012-02-20 09:31:16.000000000 +0100 @@ -1,3 +1,9 @@ +logtools (0.13d+uvt1) unstable; urgency=low + + * Add verbose option. + + -- Thijs Kinkhorst <th...@debian.org> Mon, 20 Feb 2012 09:31:03 +0100 + logtools (0.13d) unstable; urgency=low * Merged changes from NMU and fixed some more GCC 4.3 warnings. diff -Nru logtools-0.13d/clfmerge.1 logtools-0.13d+uvt1/clfmerge.1 --- logtools-0.13d/clfmerge.1 2001-09-20 15:35:44.000000000 +0200 +++ logtools-0.13d+uvt1/clfmerge.1 2012-02-20 09:32:57.000000000 +0100 @@ -3,7 +3,7 @@ clfmerge \- merge Common\-Log Format web logs based on time\-stamps .SH "SYNOPSIS" -.B clfmerge [\-\-help | \-h] [\-b size] [\-d] [file names] +.B clfmerge [\-\-help | \-h] [\-b size] [\-d] [\-v] [file names] .SH "DESCRIPTION" The @@ -67,6 +67,10 @@ which allows programs like Webalizer to produce good graphs for large hosting sites. Also it will make the domain name in lower case. +.TP +.B \-v +Be more verbose. + .SH "EXIT STATUS" .B 0 No errors diff -Nru logtools-0.13d/clfmerge.cpp logtools-0.13d+uvt1/clfmerge.cpp --- logtools-0.13d/clfmerge.cpp 2008-06-06 07:32:58.000000000 +0200 +++ logtools-0.13d+uvt1/clfmerge.cpp 2012-02-20 09:32:54.000000000 +0100 @@ -41,6 +41,8 @@ int getLine(); bool valid() const { return m_valid; } + + bool verbose; private: bool m_valid; @@ -164,7 +166,7 @@ m_valid = true; return 0; } - fprintf(stderr, "Skipping bad line: %s\n", m_line); + if ( verbose ) fprintf(stderr, "Skipping bad line: %s\n", m_line); } return 0; // to make compilers happy - will not be reached } @@ -188,7 +190,7 @@ void usage(const char *const arg) { - fprintf(stderr, "usage: %s [filenames]", arg); + fprintf(stderr, "usage: %s [OPTION] [filenames]", arg); fprintf(stderr, "\n" "This program merges web logs in common log format into a single stream\n" "on standard output. It reads from multiple input files and outputs the\n" @@ -205,10 +207,10 @@ return 0; unsigned int map_items = 0; - bool set_map_items = false, domain_mangling = false; + bool set_map_items = false, domain_mangling = false, verbose = false; int int_c; optind = 0; - while(-1 != (int_c = getopt(argc, argv, "b:hd")) ) + while(-1 != (int_c = getopt(argc, argv, "b:hdv")) ) { switch(char(int_c)) { @@ -223,6 +225,8 @@ break; case 'd': domain_mangling = true; + case 'v': + verbose = true; break; } } @@ -248,6 +252,7 @@ for(i = optind; i < argc; i++) { items[item_count] = new LogFile; + items[item_count]->verbose = verbose; int rc = items[item_count]->open(argv[i], domain_mangling); // if rc==2 then file not found, if rc==1 then 0 length file if(rc > 1) diff -Nru logtools-0.13d/debian/changelog logtools-0.13d+uvt1/debian/changelog --- logtools-0.13d/debian/changelog 2008-06-06 07:35:00.000000000 +0200 +++ logtools-0.13d+uvt1/debian/changelog 2012-02-20 09:31:16.000000000 +0100 @@ -1,3 +1,9 @@ +logtools (0.13d+uvt1) unstable; urgency=low + + * Add verbose option. + + -- Thijs Kinkhorst <th...@debian.org> Mon, 20 Feb 2012 09:31:03 +0100 + logtools (0.13d) unstable; urgency=low * Merged changes from NMU and fixed some more GCC 4.3 warnings.