CSV filter 

This filter is useful for parsing .csv files. This plugin takes an event containing CSV data, parses it, and stores it as individual fields.

Let's take some sample data and use a CSV filter to parse data out of it. Store the following data in a file named users.csv:

FName,LName,Age,Salary,EmailId,Gender
John,Thomas,25,50000,John.Thomas,m
Raj, Kumar,30,5000,Raj.Kumar,f
Rita,Tony,27,60000,Rita.Tony,m

The following code block shows the usage of the CSV filter plugin. The CSV plugin has no required parameters. It scans each row of data and uses default column names such as column1, column2, and so on to place the data. By default, this plugin uses , (a comma) as a field separator. The default separator can be changed by using the separator parameter of the plugin. You can either specify the list of column names using the columns parameter, which accepts an array of column names, or by using the autodetect_column_names parameter, set to true. In doing so, you can let the plugin know that it needs to detect column names automatically, as follows:

#csv_file.conf
input {
file{
path => "D:eslogsusers.csv"
start_position => "beginning"
}
}

filter {
csv{
autodetect_column_names => true
}
}

output {
stdout {
codec => rubydebug
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.216.51