![]() |
Icinga-core 1.4.0
next gen monitoring
|
defines and structures which are used in combination with functions from readlogs.c More...
#include "config.h"
Go to the source code of this file.
defines and structures which are used in combination with functions from readlogs.c
Definition in file readlogs.h.
#define LOGENTRY_ACTIVE_MODE 6 |
Definition at line 45 of file readlogs.h.
#define LOGENTRY_AUTOSAVE 43 |
Definition at line 91 of file readlogs.h.
#define LOGENTRY_BAILOUT 4 |
Definition at line 43 of file readlogs.h.
#define LOGENTRY_ERROR_COMMAND_EXECUTION 9 |
Definition at line 48 of file readlogs.h.
#define LOGENTRY_EXTERNAL_COMMAND 8 |
Definition at line 47 of file readlogs.h.
#define LOGENTRY_HOST_CURRENT_STATE 23 |
Definition at line 65 of file readlogs.h.
#define LOGENTRY_HOST_DOWN 10 |
Definition at line 50 of file readlogs.h.
#define LOGENTRY_HOST_DOWNTIME_CANCELLED 21 |
Definition at line 62 of file readlogs.h.
#define LOGENTRY_HOST_DOWNTIME_STARTED 19 |
Definition at line 60 of file readlogs.h.
#define LOGENTRY_HOST_DOWNTIME_STOPPED 20 |
Definition at line 61 of file readlogs.h.
#define LOGENTRY_HOST_EVENT_HANDLER 15 |
Definition at line 55 of file readlogs.h.
#define LOGENTRY_HOST_FLAPPING_DISABLED 18 |
Definition at line 59 of file readlogs.h.
#define LOGENTRY_HOST_FLAPPING_STARTED 16 |
Definition at line 57 of file readlogs.h.
#define LOGENTRY_HOST_FLAPPING_STOPPED 17 |
Definition at line 58 of file readlogs.h.
#define LOGENTRY_HOST_INITIAL_STATE 22 |
Definition at line 64 of file readlogs.h.
#define LOGENTRY_HOST_NOTIFICATION 14 |
Definition at line 54 of file readlogs.h.
#define LOGENTRY_HOST_RECOVERY 12 |
Definition at line 52 of file readlogs.h.
#define LOGENTRY_HOST_UNREACHABLE 11 |
Definition at line 51 of file readlogs.h.
#define LOGENTRY_HOST_UP 13 |
Definition at line 53 of file readlogs.h.
#define LOGENTRY_IDOMOD 41 |
Definition at line 89 of file readlogs.h.
#define LOGENTRY_LOG_ROTATION 5 |
Definition at line 44 of file readlogs.h.
#define LOGENTRY_NPCDMOD 42 |
Definition at line 90 of file readlogs.h.
#define LOGENTRY_PASSIVE_HOST_CHECK 24 |
Definition at line 67 of file readlogs.h.
#define LOGENTRY_PASSIVE_SERVICE_CHECK 40 |
Definition at line 87 of file readlogs.h.
#define LOGENTRY_RESTART 3 |
Definition at line 42 of file readlogs.h.
#define LOGENTRY_SERVICE_CRITICAL 25 |
Definition at line 69 of file readlogs.h.
#define LOGENTRY_SERVICE_CURRENT_STATE 39 |
Definition at line 85 of file readlogs.h.
#define LOGENTRY_SERVICE_DOWNTIME_CANCELLED 37 |
Definition at line 82 of file readlogs.h.
#define LOGENTRY_SERVICE_DOWNTIME_STARTED 35 |
Definition at line 80 of file readlogs.h.
#define LOGENTRY_SERVICE_DOWNTIME_STOPPED 36 |
Definition at line 81 of file readlogs.h.
#define LOGENTRY_SERVICE_EVENT_HANDLER 31 |
Definition at line 75 of file readlogs.h.
#define LOGENTRY_SERVICE_FLAPPING_DISABLED 34 |
Definition at line 79 of file readlogs.h.
#define LOGENTRY_SERVICE_FLAPPING_STARTED 32 |
Definition at line 77 of file readlogs.h.
#define LOGENTRY_SERVICE_FLAPPING_STOPPED 33 |
Definition at line 78 of file readlogs.h.
#define LOGENTRY_SERVICE_INITIAL_STATE 38 |
Definition at line 84 of file readlogs.h.
#define LOGENTRY_SERVICE_NOTIFICATION 30 |
Definition at line 74 of file readlogs.h.
#define LOGENTRY_SERVICE_OK 29 |
Definition at line 73 of file readlogs.h.
#define LOGENTRY_SERVICE_RECOVERY 28 |
Definition at line 72 of file readlogs.h.
#define LOGENTRY_SERVICE_UNKNOWN 27 |
Definition at line 71 of file readlogs.h.
#define LOGENTRY_SERVICE_WARNING 26 |
Definition at line 70 of file readlogs.h.
#define LOGENTRY_SHUTDOWN 2 |
Definition at line 41 of file readlogs.h.
#define LOGENTRY_STANDBY_MODE 7 |
Definition at line 46 of file readlogs.h.
#define LOGENTRY_STARTUP 1 |
Definition at line 40 of file readlogs.h.
#define LOGENTRY_SYSTEM_WARNING 44 |
Definition at line 92 of file readlogs.h.
#define LOGENTRY_UNDEFINED 999 |
Definition at line 94 of file readlogs.h.
#define LOGFILTER_EXCLUDE 666 |
Definition at line 100 of file readlogs.h.
#define LOGFILTER_INCLUDE 333 |
Definition at line 99 of file readlogs.h.
#define READLOG_ERROR 1 |
Definition at line 108 of file readlogs.h.
#define READLOG_ERROR_FILTER 4 |
Definition at line 111 of file readlogs.h.
#define READLOG_ERROR_MEMORY 2 |
Definition at line 109 of file readlogs.h.
#define READLOG_ERROR_NOFILE 3 |
Definition at line 110 of file readlogs.h.
#define READLOG_OK 0 |
Definition at line 107 of file readlogs.h.
typedef struct logentry_struct logentry |
log entry data struct
structure to hold single log entries get_log_entries
typedef struct logentry_filter logfilter |
log entry filter struct
structure to hold log file filters add_log_filter
int add_log_filter | ( | int | requested_filter, |
int | include_exclude | ||
) |
Add Filter to the list of log filters.
[in] | requested_filter | the id of the log entry you want to filter for |
[in] | include_exclude | type of filter
|
READLOG_OK | |
READLOG_ERROR | |
READLOG_ERROR_MEMORY |
With this function you can add filters before reading the actual log entries from file. This will prevent allocating memory for log entries we don't need anyway. Be aware that you can use only one type of filtering (include or exclude). If you want to have all entries except a view, then use the filter with exclude. If you need just a few defined ones (like in notifications.c) then use include.
Definition at line 83 of file readlogs.c.
int determine_archive_to_use_from_time | ( | time_t | target_time | ) |
returns an archive number for a given timestamp corresponding to log_rotation_method
[in] | target_time | the timestamp for which the archive number should be returned for |
target_time
This function determines log archive to use, given a specific time. The log archive number represents the log file.
In case the log_rotation_method
would be daily then this archive numbers would return:
Definition at line 471 of file readlogs.c.
void determine_log_rotation_times | ( | int | archive | ) |
determines the log rotation times
[in] | archive | number of archive to determine the log rotation times for |
determines the log rotation times - past, present, future - depending on archive
number and log_rotation_method
Definition at line 506 of file readlogs.c.
void free_log_entries | ( | void | ) |
frees all memory allocated to list of log entries in memory
Definition at line 387 of file readlogs.c.
void free_log_filters | ( | void | ) |
frees all memory allocated to list of log filters in memory
Definition at line 369 of file readlogs.c.
void get_log_archive_to_use | ( | int | archive, |
char * | file_name, | ||
int | file_name_length | ||
) |
returns the file name of a log file depending on archive
number and log_rotation_method
[in] | archive | number of log archive to return file name for |
[out] | file_name | returns the file name corresponding to archive |
[in] | file_name_length | the maximum length of the char in file_name |
This function determines the log file we should use (from current time). Depending which archive number given it returns the full file name of the log file we can read. (get_log_entries)
Definition at line 417 of file readlogs.c.
int get_log_entries | ( | char * | log_file, |
char * | search_string, | ||
int | reverse, | ||
time_t | ts_start, | ||
time_t | ts_end | ||
) |
Read's a defined log file and stores the entries into entry list struct.
[in] | log_file | the full path of the log file to read |
[in] | search_string | a string you are searching for. Set to NULL to disable search function |
[in] | reverse | this bool defines which order the log entries should return |
[in] | ts_start | defines the start timestamp for log entries
|
[in] | ts_end | defines the end timestamp for log entries
|
READLOG_OK | |
READLOG_ERROR | |
READLOG_ERROR_MEMORY | |
READLOG_ERROR_NOFILE | |
READLOG_ERROR_FILTER |
This functions reads a log_file
and and try's (if set) to filter for a search string. This search string uses regular expressions. The reverse option defines if you want have your log entries returned in normal or revers order. Normal order for returning would be from the newest entry to the oldest. You can also set a time "window". This defines if you want to exclude entries which are outside of these "window". Then only entries will be returned which are between start and end. Very useful if user has all entries in one log file.
Definition at line 142 of file readlogs.c.