Different kinds of log files are parsed by a collection of objects
[gnucomo.git] / src / gcm_input / gcm_input.cpp
index 915934e..34d768b 100644 (file)
@@ -7,7 +7,7 @@
 ***********************
 **      FILE NAME      : gcm_input.cpp
 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
-**      VERSION NUMBER : $Revision: 1.5 $
+**      VERSION NUMBER : $Revision: 1.6 $
 **
 **  DESCRIPTION      :  Application to store client messages into the database
 **                      The client message contains a log file from one of the
 ********************************
 **      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
 **      CREATION DATE   : Aug 29, 2002
-**      LAST UPDATE     : Jul 24, 2003
+**      LAST UPDATE     : Aug 11, 2003
 **      MODIFICATIONS   : 
 **************************************************************************/
 
 /*****************************
    $Log: gcm_input.cpp,v $
-   Revision 1.5  2003-08-05 08:11:06  arjen
+   Revision 1.6  2003-08-11 16:56:16  arjen
+   Different kinds of log files are parsed by a collection of objects
+   of different classes, derived from the base class line_cooker
+   Depending on the message content or the message_type element in
+   XML, one of these objects is selected.
+
+   Logrunner is integrated with gcm_input. Although its functionality
+   is still limited, a connection between logrunner and gcm_input
+   is beginning to form.
+
+   Revision 1.5  2003/08/05 08:11:06  arjen
    Added two configuration parameters:
       logfile   - Log to this file instead of stderr.
       verbosity - Verbose output if greater than 0.
 
 *****************************/
 
-static const char *RCSID = "$Id: gcm_input.cpp,v 1.5 2003-08-05 08:11:06 arjen Exp $";
+static const char *RCSID = "$Id: gcm_input.cpp,v 1.6 2003-08-11 16:56:16 arjen Exp $";
 
 #include <fstream>
 
 #include <getopt.h>
 
 #include "message.h"
+#include "syslog_cooker.h"
+#include "irix_syslog_cooker.h"
+#include "access_cooker.h"
+#include "error_cooker.h"
 
 bool verbose = false;
 bool testmode = false;
@@ -105,7 +119,7 @@ static char *Version = "gcm_input version 0.0.7 - Jul 24, 2003";
 **  VARS CHANGED   :
 **  FUNCTIONS USED :
 **  SEE ALSO       :
-**  LAST MODIFIED  : Jul 24, 2003
+**  LAST MODIFIED  : Aug 11, 2003
 **=========================================================================
 */
 
@@ -217,7 +231,16 @@ int main(int argc, char *argv[])
    if (db.is_connected())
    {
 
-      client_message  msg(&std::cin, db);
+      client_message      msg(&std::cin, db);
+      syslog_cooker       slc;
+      irix_syslog_cooker  islc;
+      access_cooker       alc;
+      error_cooker        elc;
+
+      msg.add_cooker(&slc);
+      msg.add_cooker(&islc);
+      msg.add_cooker(&alc);
+      msg.add_cooker(&elc);
 
       if (msg.classify(hostname, arrival, service) > 0.9)
       {