2 /**************************************************************************
3 ** (c) Copyright 2002, Andromeda Technology & Automation
4 ** This is free software; you can redistribute it and/or modify it under the
5 ** terms of the GNU General Public License, see the file COPYING.
6 ***************************************************************************
7 ** MODULE INFORMATION *
8 ***********************
9 ** FILE NAME : message.h
11 ** VERSION NUMBER : $Revision: 1.8 $
13 ** DESCRIPTION : Classes to for handling client messages
18 ***************************************************************************
19 ** ADMINISTRATIVE INFORMATION *
20 ********************************
21 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
22 ** CREATION DATE : Sep 16, 2002
23 ** LAST UPDATE : Aug 06, 2003
25 **************************************************************************/
27 /*****************************
29 Revision 1.8 2003-12-04 10:38:09 arjen
30 Major redesign. All input is handled through XML. Raw input data is first
31 transformed into an XML document for further processing.
32 A collection of polymorphic classes handle the transformation of various
33 input formats into XML.
34 Classifying input data is done with a finite improbability calculation.
36 Revision 1.7 2003/08/11 16:56:16 arjen
37 Different kinds of log files are parsed by a collection of objects
38 of different classes, derived from the base class line_cooker
39 Depending on the message content or the message_type element in
40 XML, one of these objects is selected.
42 Logrunner is integrated with gcm_input. Although its functionality
43 is still limited, a connection between logrunner and gcm_input
46 Revision 1.6 2003/04/29 09:16:44 arjen
48 Only cooked log entries for now.
50 Revision 1.5 2003/03/16 09:42:40 arjen
51 Read IRIX system logs.
53 Revision 1.4 2002/12/06 22:26:28 arjen
54 Set the value of log.processed to FALSE when inserting a
55 new log entry into the database
56 When a syslog entry arrives from last year, gcm_input subtracts one from the
57 year of arrival to create the year of the log entry.
58 Read output from "rpm -qa" and enter packages in the parameter table.
60 Revision 1.3 2002/11/09 08:04:27 arjen
61 Added a reference to the GPL
63 Revision 1.2 2002/11/04 10:13:36 arjen
64 Use proper namespace for iostream classes
66 Revision 1.1 2002/10/05 10:25:49 arjen
67 Creation of gcm_input and a first approach to a web interface
69 *****************************/
71 /* static const char *RCSID = "$Id: message.h,v 1.8 2003-12-04 10:38:09 arjen Exp $"; */
75 #include <AXE/String.h>
78 #include <libxml/parser.h>
80 #include "message_filter.h"
81 #include "line_cooker.h"
84 // Associates line cookers and message filters
99 xform(message_filter *m, line_cooker *l)
108 ///////////////////////////////////////////////////////////////////////////
109 // NAME : client_message
113 // METHODS : classify()
120 // LAST MODIFIED : Aug 06, 2003
121 ///////////////////////////////////////////////////////////////////////////
126 String hostname; // Where the message came from (FQDN)
127 UTC arrival; // When we got the message.
128 String service; // Service that created the message
130 std::list<xform> kitchen; // The collection of message filters and line cookers
131 xform pan; // The one we cook this log with
133 bool mail_header; // Does the message contain a mail header ?
134 bool gpg_encrypted; // Is the message encrypted ?
136 std::strstream xmlBuffer;
139 double certainty; // How certain are we about the message
142 UNKNOWN, RPMLIST, XML, COOKER_OBJECT
146 message_buffer input;
147 gnucomo_database database;
150 bool extractHeader();
154 client_message(std::istream *in, gnucomo_database db);
156 void add_cooker(line_cooker *lc, message_filter *mf)
160 kitchen.push_back(x);
163 double classify(String host, UTC arrival = Now(), String serv = "");