00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __AWHANDLER_LOGFILE__
00023 #define __AWHANDLER_LOGFILE__
00024
00025 #include "hash.h"
00026 #include "regexmatch.h"
00027 #include "monitor.h"
00028 #include "wire.h"
00029
00031
00032
00076
00081
00122
00123
00124
00125
00126
00127
00128
00129
00130
00134 typedef struct aw_logfilehandler_digest_s {
00135
00136
00137 struct aw_logfilehandler_digest_s *next;
00138
00139
00140 byte_t
00141 *line;
00142
00143
00144 aw_event_sig_t
00145 *eventsig;
00146
00147 aw_timestamp_t
00148 createtime;
00149
00150 u_int32_t
00151 count;
00152
00153 } aw_logfilehandler_digest_t;
00154
00158 typedef struct {
00159
00160 aw_event_sig_t
00161 match,
00162 nomatch;
00163
00164 } aw_logfilehandler_events_t;
00165
00169 typedef struct {
00170
00171 int32_t
00172 fd;
00173
00174 ino_t
00175 inode;
00176
00177 off_t
00178 offset;
00179
00180 aw_hashString_t
00181 *line2digest;
00182
00183 aw_logfilehandler_digest_t
00184 *active_digests;
00185
00186 } aw_logfilehandler_state_t;
00187
00188
00192 typedef struct {
00193
00194 aw_logfilehandler_events_t
00195 events;
00196
00197
00198 const byte_t
00199 *regex;
00200
00201
00202 const byte_t
00203 *subst;
00204
00205 } aw_logfilehandler_regex_t;
00206
00210 typedef struct {
00211
00212 aw_logfilehandler_events_t
00213 events;
00214
00215
00216 regex_t
00217 pattern;
00218
00219
00220 byte_t
00221 *subst;
00222
00223 } aw_logfilehandler_watcher_t;
00224
00228 typedef struct {
00229
00230 aw_handler_t
00231 handler_header;
00232
00233
00234 int32_t
00235 max_line_len;
00236
00237
00238 const char
00239 *filename;
00240
00241 u_int32_t
00242 nwatchers;
00243
00244 aw_logfilehandler_watcher_t
00245 *watchers;
00246
00247
00248 aw_timestamp_t
00249 digest_interval;
00250
00251 aw_logfilehandler_state_t
00252 state;
00253
00254 } aw_logfilehandler_t ;
00255
00256
00269 aw_logfilehandler_t *aw_create_logfilehandler(const byte_t *filename,
00270 const u_int32_t nregexs,
00271 const aw_logfilehandler_regex_t *regexs,
00272 const aw_timestamp_t digest_interval,
00273 int32_t (*regevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00274 int32_t (*regmaskevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00275 const aw_alarm_sched_t *sched,
00276 aw_logger_t *logger
00277 );
00278
00283 void aw_free_logfilehandler(aw_logfilehandler_t *p);
00284
00288 aw_handler_t *aw_wire_logfilehandler(aw_wire_mkhandler_args_t *args);
00289
00290
00291
00292 #endif
00293