***********************
** FILE NAME : message.cpp
** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
-** VERSION NUMBER : $Revision: 1.13 $
+** VERSION NUMBER : $Revision: 1.14 $
**
** DESCRIPTION : Implementation of the message handling classes
**
/*****************************
$Log: message.cpp,v $
- Revision 1.13 2003-08-16 15:28:45 arjen
+ Revision 1.14 2003-09-01 06:57:14 arjen
+ Reject log entries that are found to be invalid.
+
+ Revision 1.13 2003/08/16 15:28:45 arjen
Fixed a namespace problem
Revision 1.12 2003/08/11 16:56:16 arjen
*****************************/
-static const char *RCSID = "$Id: message.cpp,v 1.13 2003-08-16 15:28:45 arjen Exp $";
+static const char *RCSID = "$Id: message.cpp,v 1.14 2003-09-01 06:57:14 arjen Exp $";
#include <algorithm>
#include <libxml/xpath.h>
}
else if (!arrival.proper())
{
- *log << "Arrival time is not knwon.\n";
+ *log << "Arrival time is not known.\n";
certainty = 0.0;
}
else
#ifdef DEBUG
std::cerr << "\ncooker check: " << pan->check_pattern(line) << "\n";
#endif
- pan->cook_this(line, arrival);
-
- if (pan->hostname() == hostname(0,~pan->hostname()))
+ if (pan->cook_this(line, arrival))
{
+ if (pan->hostname() == hostname(0,~pan->hostname()))
+ {
#ifdef DEBUG
- std::cerr << " Information from cooker:\n";
- std::cerr << " timestamp = " << pan->timestamp() << "\n";
- std::cerr << " hostname = " << pan->hostname() << "\n";
- std::cerr << " service = " << pan->service() << "\n";
+ std::cerr << " Information from cooker:\n";
+ std::cerr << " timestamp = " << pan->timestamp() << "\n";
+ std::cerr << " hostname = " << pan->hostname() << "\n";
+ std::cerr << " service = " << pan->service() << "\n";
#endif
- /* Insert a new record into the log table */
+ /* Insert a new record into the log table */
- insertion += "'" + objectid + "',";
- insertion += "'" + pan->service() + "',";
- insertion += "'" + pan->timestamp().format("%Y-%m-%d %T") + "',";
- insertion += "'" + arrival.format("%Y-%m-%d %T") + "',";
- insertion += "'" + SQL_Escape(line) + "',FALSE";
- insertion += ")";
+ insertion += "'" + objectid + "',";
+ insertion += "'" + pan->service() + "',";
+ insertion += "'" + pan->timestamp().format("%Y-%m-%d %T") + "',";
+ insertion += "'" + arrival.format("%Y-%m-%d %T") + "',";
+ insertion += "'" + SQL_Escape(line) + "',FALSE";
+ insertion += ")";
- if (testmode)
- {
- *log << insertion << "\n";
+ if (testmode)
+ {
+ *log << insertion << "\n";
+ }
+ else
+ {
+ database.Query(insertion);
+ }
+
+ if (verbose)
+ {
+ *log << "\n\n";
+ }
+
+ nr_lines++;
}
else
{
- database.Query(insertion);
+ *log << " Hostname " << pan->hostname() << " does not match.\n";
}
-
- if (verbose)
- {
- *log << "\n\n";
- }
-
- nr_lines++;
}
else
{
- *log << " Hostname " << pan->hostname() << " does not match.\n";
+ *log << "gcm_input WARNING: Not a valid line: " << line << "\n";
}
break;