From a78d04984240a3d04045402c964d9d8c5be463ef Mon Sep 17 00:00:00 2001 From: Dmitri Pal Date: Sun, 27 Sep 2009 22:16:17 -0400 Subject: ELAPI Resolving message attribute This patch continues work started with the previous patch. It resolves message attribute. Message attribute is a special attribute in the event that may contain references to other attributes in the event. When message is resolved the references are replaced with actual values of the referenced attributes. --- common/elapi/elapi_test/Makefile.am | 1 + common/elapi/elapi_test/elapi_ut.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'common/elapi/elapi_test') diff --git a/common/elapi/elapi_test/Makefile.am b/common/elapi/elapi_test/Makefile.am index dcf1707c..c0eac8a5 100644 --- a/common/elapi/elapi_test/Makefile.am +++ b/common/elapi/elapi_test/Makefile.am @@ -32,6 +32,7 @@ libelapi_test_la_SOURCES = \ ../elapi_basic.h \ ../elapi_resolve.c \ ../elapi_async.c \ + ../elapi_subst.c \ ../elapi_event.h \ ../elapi_priv.h \ ../elapi_sink.h \ diff --git a/common/elapi/elapi_test/elapi_ut.c b/common/elapi/elapi_test/elapi_ut.c index 1046ed0e..ab0f88d1 100644 --- a/common/elapi/elapi_test/elapi_ut.c +++ b/common/elapi/elapi_test/elapi_ut.c @@ -76,7 +76,7 @@ int simple_event_test(void) printf("Simple test START:\n"); error = elapi_set_default_template( - E_BASE_DEFV1 | E_BASE_HOSTEXT, + E_BASE_DEFV1 | E_BASE_HOSTEXT /* FIXME Ticket #207 */, "%n( bin )", bin, 8, " %sb( logical1 )", "false", "%sb( logical2 )", "YES", @@ -391,6 +391,34 @@ int complex_event_test(void) return error; } + error = elapi_dsp_msg(E_TARGET_DEBUG, + dispatcher, + template, + E_MESSAGE, + "date = %(R_stamp__), pid = %(__pid__), " + "hostname = %(__host__), %(__halias__), " + "ip = %(__ip__), [%(__iplist__);%(!__iplist__);%(__iplist__)]" , + E_EOARG); + if (error) { + elapi_destroy_event_template(template); + printf("Failed to log event! %d\n", error); + return error; + } + + error = elapi_dsp_msg(E_TARGET_DEBUG, + dispatcher, + template, + E_MESSAGE, + "date = %(R_stamp__), pid = %(__pid__), " + "hostname = %(__host__), %(__halias__), " + "ip = %(__ip__), [%(__iplist__);%(__iplist__);%(__iplist__)]" , + E_EOARG); + if (error) { + elapi_destroy_event_template(template); + printf("Failed to log event! %d\n", error); + return error; + } + elapi_destroy_event_template(template); elapi_print_dispatcher(dispatcher); -- cgit