diff options
Diffstat (limited to 'dispatcher/elapi_dispatcher.c')
-rw-r--r-- | dispatcher/elapi_dispatcher.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/dispatcher/elapi_dispatcher.c b/dispatcher/elapi_dispatcher.c index 3995310..27a3eca 100644 --- a/dispatcher/elapi_dispatcher.c +++ b/dispatcher/elapi_dispatcher.c @@ -28,10 +28,8 @@ #include "elapi_collection.h" #include "elapi_sink.h" -#define SINK_COLLECTION "sinks" - -char def_application_name[] = "unknown"; - +char sink_collection[] = "sinks"; +char def_application_name[] = "default"; char *default_sinks[] = { "ipa","kernel","syslog","file","stderr", NULL }; @@ -39,6 +37,7 @@ char *default_sinks[] = { "ipa","kernel","syslog","file","stderr", NULL }; struct sink_context { struct collection_item *event; struct dispatcher_handle *handle; + char *format; char *previous; int previous_status; }; @@ -374,6 +373,7 @@ static int sink_handler(char *sink, sink_env->previous, sink_env->previous_status, sink_env->event, + sink_env->format, sink_data, (sink_env->handle)->custom_data, &error); @@ -428,6 +428,7 @@ static int default_router(char *sink, char *previous_sink, int previous_status, struct collection_item *event, + char *format_string struct sink_descriptor *sink_data, void *custom_data, int *error) @@ -441,7 +442,7 @@ static int default_router(char *sink, */ - *error = log_event_to_sink(sink_data,event,custom_data); + *error = log_event_to_sink(sink_data,event,format_string,custom_data); @@ -462,7 +463,7 @@ static int construct_sink_list(struct dispatcher_handle *handle) DEBUG_STRING("construct_sink_list","Entry"); /* Allocate collection to store sinks */ - error=create_collection(&(handle->sink_list),SINK_COLLECTION); + error=create_collection(&(handle->sink_list),sink_collection); if(error != 0) { DEBUG_NUMBER("Failed to create sink collection. Error",error); /* No cleanup here. @@ -603,6 +604,7 @@ void destroy_audit_dispatcher(struct dispatcher_handle *dispatcher) /* Log evento into a specific sink */ int log_event_to_sink(struct sink_descriptor *sink_data, struct collection_item *event, + char *format_string, void *custom_data) { int error = EOK; @@ -617,7 +619,7 @@ int log_event_to_sink(struct sink_descriptor *sink_data, DEBUG_SINK(sink_data); /* Format (serialize the event) */ - error = sink_cpb->format_cb(&(sink_data->dblock),event); + error = sink_cpb->format_cb(&(sink_data->dblock),format_string,event); if(error != EOK) { DEBUG_NUMBER("Format function returned error",error); return error; @@ -637,7 +639,7 @@ int log_event_to_sink(struct sink_descriptor *sink_data, /* Function to clean memory associated with the audit dispatcher */ -void log_audit_event(struct dispatcher_handle *dispatcher, struct collection_item *event) +void log_audit_event(struct dispatcher_handle *dispatcher, char *format_str, struct collection_item *event) { struct sink_context sink_env; @@ -653,6 +655,7 @@ void log_audit_event(struct dispatcher_handle *dispatcher, struct collection_ite sink_env.handle = dispatcher; sink_env.event = event; + sink_env.format = format_str; /* Logging an event is just iterating through the sinks and calling the sink_handler */ (void)traverse_collection(dispatcher->sink_list,ELAPI_TRAVERSE_ONELEVEL,sink_handler,(void *)(&sink_env)); |