3
responses
responses
Hi,
I'm trying to transfer two different csv files having different set of columns to a location.
I'm trying to define them in one config file.
I would like to know how we define the Extension module for this scenario since xm_csv is going to be the common one for the entire file.
Is there any option to use more than one extension module with xm_csv specific to each file?
Sample:
Is this possible in one config file?
Extension
<Extension csv_parser>
Module xm_csv
Fields A,B,C,D
Delimiter ,
</Extension>
<Extension csv_parser>
Module xm_csv
Fields E,F,G
Delimiter ,
</Extension>
Comments (2)
Thanks for your response. I have written the config for 2 csv files and 1 w3c file from different locations as input and sending them to different output ports via tcp.
Please let me know whether it is correct? I would like to know if the logic will work.
<Extension csv_parser1>
Module xm_csv
Fields a,b,c,d
Delimiter ,
</Extension>
<Extension csv_parser2>
Module xm_csv
Fields e,f,g
Delimiter ,
</Extension>
<Extension w3c_parser>
Module xm_w3c
</Extension>
# 1st csv input from one location
<Input csv1>
Module im_file
File '%BASEDIR%location A'
<Exec>
if $raw_event =~ /^(\xEF\xBB\xBF)?(date-time,|#)/ drop();
else
{
csv_parser1->parse_csv();
$EventTime = parsedate(${date-time});
}
</Exec>
</Input>
# 2nd csv input
<Input csv2>
Module im_file
File '%BASEDIR%\Location B'
<Exec>
if $raw_event =~ /^(\xEF\xBB\xBF)?(date-time,|#)/ drop();
else
{
csv_parser2->parse_csv();
$EventTime = parsedate(${date-time});
}
</Exec>
</Input>
# w3c input
<Input w3c>
Module im_file
File 'Location C'
InputType w3c_parser
</Input>
# Direct each input to a separate output port
<Output tcp_csv1>
Module om_tcp
Host 10.X.X
Port 1
</Output>
<Output tcp_csv2>
Module om_tcp
Host 10.X.X
Port 2
</Output>
<Output tcp_w3c>
Module om_tcp
Host 10.X.X
Port 3
</Output>
<Route 1>
Priority 1
Path csv1=> tcp_csv1
</Route>
<Route 2>
Priority 2
Path csv2 => tcp_csv2
</Route>
<Route 3>
Priority 3
Path w3c => tcp_w3c
</Route>
The logic looks good and it should do what you need.