summaryrefslogtreecommitdiffstats
path: root/common/elapi/elapi_test
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2009-09-02 19:41:06 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-09-08 19:26:27 -0400
commit13cf6a9c9d37a14ff46f6d512aab402616359570 (patch)
tree81b8dae12607b7df36c422191575c1a99009c060 /common/elapi/elapi_test
parentc5461b548d303e6e66e20048544814338b46efb5 (diff)
downloadsssd-13cf6a9c9d37a14ff46f6d512aab402616359570.tar.gz
sssd-13cf6a9c9d37a14ff46f6d512aab402616359570.tar.xz
sssd-13cf6a9c9d37a14ff46f6d512aab402616359570.zip
ELAPI Adding file provider and CSV format
This patch creates the infrastructure for logging of the event from the top of the interface to the bottom. It is a start. A lot of functionality is left aside. The attempt of this patch is pass event from caller of the ELAPI interface via targets to sinks then to providers and do serialization creating entity that is ready to be written to a file. It also implements more specific provider related configuration parameters. Also it addresses couple suggestions that were brought up against previous patch. ELAPI Correcting issues This patch addresses the issues found during the review of the previous patches and addresses ticket #166.
Diffstat (limited to 'common/elapi/elapi_test')
-rw-r--r--common/elapi/elapi_test/Makefile.am11
-rw-r--r--common/elapi/elapi_test/configure.ac6
-rw-r--r--common/elapi/elapi_test/elapi_ut.conf98
3 files changed, 106 insertions, 9 deletions
diff --git a/common/elapi/elapi_test/Makefile.am b/common/elapi/elapi_test/Makefile.am
index cac0ead6d..f2368f129 100644
--- a/common/elapi/elapi_test/Makefile.am
+++ b/common/elapi/elapi_test/Makefile.am
@@ -5,8 +5,7 @@ topdir=$(srcdir)/../..
AM_CFLAGS = -DELAPI_DEFAULT_CONFIG_DIR=\"$(srcdir)\" \
-DELAPI_DEFAULT_CONFIG_APP_DIR=\"$(srcdir)\" \
-DELAPI_DEFAULT_APP_NAME=\"elapi_ut\" \
- -DELAPI_DEFAULT_APP_NAME_SIZE=127 \
- -DELAPI_UTEST
+ -DELAPI_DEFAULT_APP_NAME_SIZE=127
if HAVE_GCC
AM_CFLAGS += \
@@ -27,6 +26,8 @@ libelapi_test_la_SOURCES = \
../elapi_log.c \
../elapi_internal.c \
../elapi_sink.c \
+ ../elapi_basic.c \
+ ../elapi_basic.h \
../elapi_event.h \
../elapi_priv.h \
../elapi_sink.h \
@@ -34,7 +35,11 @@ libelapi_test_la_SOURCES = \
../elapi_async.h \
../elapi.h \
../providers/file/file_provider.c \
- ../providers/file/file_provider.h
+ ../providers/file/file_provider.h \
+ ../providers/file/file_util.c \
+ ../providers/file/file_util.h \
+ ../providers/file/file_fmt_csv.c \
+ ../providers/file/file_fmt_csv.h
# Build unit test
check_PROGRAMS = elapi_ut
diff --git a/common/elapi/elapi_test/configure.ac b/common/elapi/elapi_test/configure.ac
index 9297acfa8..44524e708 100644
--- a/common/elapi/elapi_test/configure.ac
+++ b/common/elapi/elapi_test/configure.ac
@@ -21,6 +21,12 @@ AC_ARG_ENABLE([trace],
[trace_level="0"])
AS_IF([test ["$trace_level" -gt "0"] -a ["$trace_level" -lt "8"] ],[AC_SUBST([TRACE_VAR],["-DTRACE_LEVEL=$trace_level"])])
+# Enable trace build
+AC_ARG_ENABLE([verbose],
+ [AS_HELP_STRING([--enable-verbose],[build with verbose output])],
+ [AC_DEFINE([ELAPI_VERBOSE],[],[add verbose output])],[])
+
+m4_include(../def_macros.m4)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/common/elapi/elapi_test/elapi_ut.conf b/common/elapi/elapi_test/elapi_ut.conf
index a5ad7a0b2..00b5912a1 100644
--- a/common/elapi/elapi_test/elapi_ut.conf
+++ b/common/elapi/elapi_test/elapi_ut.conf
@@ -43,7 +43,7 @@ targets=debug, audit, log
[debug]
value = 1
-sinks = debugfile, stderr
+sinks = debugfile, screen
[audit]
value = 2
@@ -59,9 +59,9 @@ sinks = logfile, syslog
;
; provider - (required)
; Defines the name of the sink or the special reserved word to
-; indecate that it is a sink provided natively by ELAPI library.
+; indicate that it is a sink provided by ELAPI library.
;
-; Special sinks provided natively by ELAPI are:
+; Special sinks provided by ELAPI are:
; file
; stderr
; syslog
@@ -93,7 +93,88 @@ sinks = logfile, syslog
; default is 60 seconds
;
; synch - yes/no (default no) - a flag that forces the sink to act synchronously
-; even if it can support async operations
+; even if it can support async operations.
+; If application needs to have some events with guaranteed delivery
+; and wishes to block for those the implementation should
+; send such events to a special target that would consist
+; of the sinks that act in the synch mode and guarantee
+; the delivery or return failure.
+
+; SPECIFIC FIELDS FOR DIFFERENT SINKS
+;
+; 1) FILE SINK
+;
+; filename - name of the log file. If not specified <appname>.log will be used.
+; Avoid using the same name of the file for different sinks,
+; the result might be unpredictable.
+; If file name is "stderr" the output will be sent to file descriptor 2.
+; If application closed file descriptor 2 the log attempt will
+; cause error and onerror value for the sink will be ignored.
+; The sink will be permanently disabled causing ELAPI to skip
+; it.
+; The "keepopen" and "fsyncmode" parameters are ignored for
+; "stderr" sink.
+;
+; keepopen - yes/no (default no) - keep file open
+;
+; outmode - 0 - CSV like (default)
+; 1 - use format specifier
+; 2 - HTML
+; 3 - XML
+; 4 - JSON
+; 5 - key-value pairs
+;
+; set - use only specific subset of fields in the given order
+; comma separated list of field names that are expected from
+; an event
+; The set can optionally end with an item:
+; @ - this would indicate that all the rest of the fields need to
+; be added at the end as separate fields.
+; @n - where n is one of the modes from "outmode" list.
+; in this case the all remaining fields will be jammed into one field
+; using specified format. In case of CSV jammed into CSV it is recommended
+; to use qualifier and set cvsescape to true
+; If the @ sign is absent only fields from the specified set will be
+; included into the output.
+; If event does not contain a specific field it will be empty in the output.
+;
+; fsyncmode - Defines if the data needs to be flushed to disk and how frequently
+; If this value is missing or 0 - no flushing.
+; If it is positive it denotes the number of events before next flush.
+; If it is negative it denotes the number of seconds before next flush.
+;
+; Format specific parameters:
+;
+; CSV related parameters (all optional):
+;
+; csvqual - what to use as string qualifier for CSV outmode.
+; One character string.
+; If empty no qualifier is used.
+; If not specified then double quote is used.
+; csvsep - what to use as CSV field separator.
+; One character string.
+; If empty no separator is used.
+; If not specified comma is used.
+; csvescsym - which symbol to use as escape symbol.
+; One character string.
+; If empty or no qualifier no escaping is done.
+; If missing the "\" (backslash) is used.
+; Escaping is done only if both the qualifier
+; and the escape symbol are not empty.
+; csvspace - what to use as space after the separator. Default is space.
+; use "space" for space
+; use "tab" for tab
+; use "cr" for new line
+; Other value would cause an error.
+; csvnumsp - number of space characters to use. Default is 1.
+; csvheader - yes/no (default no). Include header into csv file.
+; Respected only if the "set" is explicitely defined.
+;
+;
+; HTML related parameters
+;
+; htmlheader - create header row
+; ... TO BE Continued...
[debugfile]
provider=file
@@ -113,9 +194,14 @@ required=true
onerror=1
timeout=90
-[stderr]
-provider=stderr
+[screen]
+provider=file
+filename=stderr
+keepopen=false
synch=false
+onerror=0
+fsyncmode=-10
+set=a, b, c, @0
[syslog]
provider=syslog