test_utils_heap_LDADD = libheap.la $(COMMON_LIBS)
test_utils_message_parser_SOURCES = \
- src/utils_message_parser_test.c \
+ src/utils/message_parser/message_parser_test.c \
src/testing.h \
src/daemon/configfile.c \
src/daemon/types_list.c \
src/utils_tail_match.c src/utils_tail_match.h \
- src/utils_tail.c src/utils_tail.h \
- src/utils_match.c src/utils_match.h \
- src/utils_latency.c src/utils_latency.h \
- src/utils_latency_config.c src/utils_latency_config.h
+ src/utils/tail/tail.c src/utils/tail/tail.h \
+ src/utils/match/match.c src/utils/match/match.h \
+ src/utils/latency/latency.c src/utils/latency/latency.h \
+ src/utils/latency/latency_config.c src/utils/latency/latency_config.h
test_utils_message_parser_CPPFLAGS = $(AM_CPPFLAGS)
test_utils_message_parser_LDADD = liboconfig.la libplugin_mock.la -lm
if BUILD_PLUGIN_LOGPARSER
pkglib_LTLIBRARIES += logparser.la
logparser_la_SOURCES = src/logparser.c \
- src/utils_message_parser.c src/utils_message_parser.h \
+ src/utils/message_parser/message_parser.c src/utils/message_parser/message_parser.h \
src/utils_tail_match.c src/utils_tail_match.h \
- src/utils_tail.c src/utils_tail.h \
- src/utils_match.c src/utils_match.h \
- src/utils_latency.c src/utils_latency.h \
- src/utils_latency_config.c src/utils_latency_config.h
+ src/utils/tail/tail.c src/utils/tail/tail.h \
+ src/utils/match/match.c src/utils/match/match.h \
+ src/utils/latency/latency.c src/utils/latency/latency.h \
+ src/utils/latency/latency_config.c src/utils/latency/latency_config.h
logparser_la_CPPFLAGS = $(AM_CPPFLAGS)
logparser_la_LDFLAGS = $(PLUGIN_LDFLAGS) -lm
test_plugin_logparser_SOURCES = src/logparser_test.c \
- src/utils_message_parser.c \
+ src/utils/message_parser/message_parser.c \
src/utils_tail_match.c src/utils_tail_match.h \
- src/utils_tail.c src/utils_tail.h \
- src/utils_match.c src/utils_match.h \
+ src/utils/tail/tail.c src/utils/tail/tail.h \
+ src/utils/match/match.c src/utils/match/match.h \
src/daemon/configfile.c \
src/daemon/types_list.c
test_plugin_logparser_CPPFLAGS = $(AM_CPPFLAGS)
AC_PLUGIN([load], [$plugin_load], [System load])
AC_PLUGIN([log_logstash], [$plugin_log_logstash], [Logstash json_event compatible logging])
AC_PLUGIN([logfile], [yes], [File logging plugin])
-AC_PLUGIN([logparser], [yes], [Log parsing plugin])
+AC_PLUGIN([logparser], [yes], [Log parsing plugin])
AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
AC_PLUGIN([lua], [$with_liblua], [Lua plugin])
AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
=item B<FirstFullRead> I<true>|I<false>
-Set to true if want to read the file from the beginning first time.
+Set to true if the file has to be parsed from the beginning on the first read.
+If false only subsequent writes to log file will be parsed.
=item B<Message> I<Name>
-B<Message> block contains matches to search the log file for.
+B<Message> block contains matches to search the log file for. Each B<Message>
+block builds a notification message using matched elements if its mandatory
+B<Match> blocks are matched.
=item B<DefaultPluginInstance> I<String>
-Sets the default plugin instance.
+Sets the default value for the plugin instance of the notification.
=item B<DefaultType> I<String>
-Sets the default type.
+Sets the default value for the type of the notification.
=item B<DefaultTypeInstance> I<String>
-Sets the default type instance.
+Sets the default value for the type instance of the notification.
=item B<DefaultSeverity> I<String>
If set to true, it sets plugin instance to string returned by regex. It can be
overridden by user string.
-=item B<Tyoe> I<true>|I<String>
+=item B<Type> I<true>|I<String>
Sets notification type using rules like B<PluginInstance>.
-=item B<TyoeInstance> I<true>|I<String>
+=item B<TypeInstance> I<true>|I<String>
Sets notification type instance using rules like above.
#include "collectd.h"
-#include "common.h"
+#include "utils/common/common.h"
+#include "utils/message_parser/message_parser.h"
#include "utils_llist.h"
-#include "utils_message_parser.h"
#define PLUGIN_NAME "logparser"
#include <regex.h>
-#define UTILS_MATCH_FLAGS_REGEX 0x04
#define UTILS_MATCH_FLAGS_EXCLUDE_REGEX 0x02
#define UTILS_MATCH_FLAGS_REGEX 0x04
/*
- * collectd - src/utils_message_parser.c
+ * collectd - src/utils/message_parser/message_parser.c
* MIT License
*
* Copyright(c) 2017-2018 Intel Corporation. All rights reserved.
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
+#include "utils/common/common.h"
-#include "utils_message_parser.h"
+#include "utils/message_parser/message_parser.h"
#define UTIL_NAME "utils_message_parser"
if (self->message_idx >= self->messages_max_len) {
INFO(UTIL_NAME ": Exceeded message buffer size: %zu",
self->messages_max_len);
- if (self->resize_message_buffer(
- self, self->messages_max_len + MSG_STOR_INC_STEP) != 0) {
+ if (self->resize_message_buffer(self, self->messages_max_len +
+ MSG_STOR_INC_STEP) != 0) {
ERROR(UTIL_NAME ": Insufficient message buffer size: %zu. Remaining "
"messages for this read will be skipped",
self->messages_max_len);
/*
- * collectd - src/utils_message_parser.h
+ * collectd - src/utils/message_parser/message_parser.h
* MIT License
*
* Copyright(c) 2017-2018 Intel Corporation. All rights reserved.
/**
- * collectd - src/utils_message_parser_test.c
+ * collectd - src/utils/message_parser/message_parser_test.c
*
* Copyright(c) 2018 Intel Corporation. All rights reserved.
*
**/
#include "testing.h"
-#include "utils_message_parser.c"
+#include "utils/message_parser/message_parser.c"
#define TEST_PATTERN_NAME "test_pattern_name"
#define TEST_REGEX "test_regex"
* if we re-open the same file again or the file opened is the first at all
* or the first after an error */
if ((obj->stat.st_ino == 0) || (obj->stat.st_ino == stat_buf.st_ino))
- seek_end = force_rewind ? false : true;
+ seek_end = !force_rewind;
FILE *fh = fopen(obj->file, "r");
if (fh == NULL) {