summaryrefslogtreecommitdiffstats
path: root/include/sh_log_evalrule.h
blob: 1b7ccae423590a6d9a4f85a1205164f98d95723c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef SH_EVALRULE_H
#define SH_EVALRULE_H

/* Clean up everything.
 */
void sh_eval_cleanup();

/* Define a new reporting queue, str := label:interval:(report|sum):severity
 */
int sh_eval_qadd (const char * str);

/* Add a new rule, str := queue:regex
 * If there is an open group, add it to its rules.
 * ..else, add it to the currently open host (open the
 * default host, if there is no open one)
 */
int sh_eval_radd (const char * str);

/* Open a new host group definition.
 */
int sh_eval_hadd (const char * str);
/*
 * End the host definition
 */
int sh_eval_hend (const char * str);


/* Open a new group definition. If a host is currently open, 
 * the new group will automatically be added to that host.
 */
int sh_eval_gadd (const char * str);
/*
 * End the group definition
 */
int sh_eval_gend (const char * str);

/* Process a single log record
 */
int sh_eval_process_msg(struct sh_logrecord * record);

enum policies {
  EVAL_REPORT,
  EVAL_SUM
};

struct sh_qeval  /* Queue with definitions */
{
  sh_string       * label;
  enum policies     policy;
  int               severity;
  sh_string       * alias;
  time_t            interval;        /* if EVAL_SUM, interval   */ 
  struct sh_qeval * next;
};

struct sh_qeval * sh_log_find_queue(const char * str);

int sh_log_lookup_severity(const char * str);
sh_string * sh_log_lookup_alias(const char * str);

#endif