aboutsummaryrefslogtreecommitdiffstats
path: root/daemon/conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/conf.c')
-rw-r--r--daemon/conf.c85
1 files changed, 72 insertions, 13 deletions
diff --git a/daemon/conf.c b/daemon/conf.c
index 9dfb248..c31115b 100644
--- a/daemon/conf.c
+++ b/daemon/conf.c
@@ -125,8 +125,7 @@ static void create_source( int line_number,
/******************************************************************************
* init_file_dest
*
- * read attributes of element, initialize destination structure and append
- * it to the list of destinations
+ * read attributes of element and initialize destination structure
*/
static gboolean init_file_dest( struct destination *dest,
int line_number,
@@ -203,6 +202,46 @@ static gboolean init_file_dest( struct destination *dest,
}
/******************************************************************************
+ * init_relay_dest
+ *
+ * read attributes of element and initialize destination structure
+ */
+static gboolean init_relay_dest( struct destination *dest,
+ int line_number,
+ const gchar** attribute_names,
+ const gchar** attribute_values )
+{
+ const gchar *aname;
+
+ for( ; (aname = *attribute_names) != NULL; attribute_names++, attribute_values++ )
+ {
+ const gchar *aval = *attribute_values;
+ if( strcmp( aname, "collector" ) == 0 )
+ dest->u.relay.collector = g_strdup( aval );
+ else if( strcmp( aname, "omit_hostname" ) == 0 )
+ {
+ if( strcmp( aval, "yes" ) == 0 )
+ dest->u.relay.omit_hostname = TRUE;
+ else if( strcmp( aval, "no" ) == 0 )
+ dest->u.relay.omit_hostname = FALSE;
+ else
+ {
+ dest->u.relay.omit_hostname = FALSE;
+ ERR( "Invalid value \"%s\" of attribute \"%s\" at line %d; assumed \"no\"\n",
+ aval, aname, line_number );
+ }
+ }
+ }
+ if( !dest->u.relay.collector )
+ {
+ ERR( "Undefined destination relay at line %d\n", line_number );
+ return FALSE;
+ }
+
+ return init_destination_relay( dest );
+}
+
+/******************************************************************************
* create_destination
*
* read attributes of element, initialize destination structure and append
@@ -231,6 +270,11 @@ static void create_destination( int line_number,
dest->type = DT_FILE;
break;
}
+ else if( strcmp( aname, "collector" ) == 0 )
+ {
+ dest->type = DT_RELAY;
+ break;
+ }
}
if( !dest->name )
{
@@ -245,6 +289,10 @@ static void create_destination( int line_number,
r = init_file_dest( dest, line_number, attribute_names, attribute_values );
break;
+ case DT_RELAY:
+ r = init_relay_dest( dest, line_number, attribute_names, attribute_values );
+ break;
+
default:
ERR( "Undefined destination type at line %d\n", line_number );
break;
@@ -734,17 +782,28 @@ static void dump_configuration()
for( item = destinations; item; item = item->next )
{
struct destination *d = item->data;
- TRACE( "\tname=%s\tfile=%s\n"
- "\t\trotate=%s size=%d backlogs=%d ifempty=%s\n"
- "\t\tolddir=%s compresscmd=%s\n",
- d->name, d->u.file.name_pattern,
- (d->u.file.rotate == RP_DAILY)? "daily"
- : (d->u.file.rotate == RP_WEEKLY)? "weekly"
- : (d->u.file.rotate == RP_MONTHLY)? "monthly"
- : "undefined",
- d->u.file.size, d->u.file.backlogs, d->u.file.ifempty? "yes" : "no",
- d->u.file.olddir? d->u.file.olddir : "NULL",
- d->u.file.compresscmd? d->u.file.compresscmd : "NULL" );
+ switch( d->type )
+ {
+ case DT_FILE:
+ TRACE( "\tname=%s\tfile=%s\n"
+ "\t\trotate=%s size=%d backlogs=%d ifempty=%s\n"
+ "\t\tolddir=%s compresscmd=%s\n",
+ d->name, d->u.file.name_pattern,
+ (d->u.file.rotate == RP_DAILY)? "daily"
+ : (d->u.file.rotate == RP_WEEKLY)? "weekly"
+ : (d->u.file.rotate == RP_MONTHLY)? "monthly"
+ : "undefined",
+ d->u.file.size, d->u.file.backlogs, d->u.file.ifempty? "yes" : "no",
+ d->u.file.olddir? d->u.file.olddir : "NULL",
+ d->u.file.compresscmd? d->u.file.compresscmd : "NULL" );
+ break;
+ case DT_RELAY:
+ TRACE( "\tname=%s\tcollector=%s\n"
+ "\t\tomit_hostname=%s\n",
+ d->name, d->u.file.name_pattern,
+ d->u.relay.omit_hostname? "yes" : "no" );
+ break;
+ }
}
TRACE( "Filters:\n" );
for( item = filters; item; item = item->next )