Hi,
I have a csv filter which generates the fields. I want to check all the generated fields (whether all the characters are numbers), if then mutate those fields to Integer.
Regards
Bharath
Hi,
I have a csv filter which generates the fields. I want to check all the generated fields (whether all the characters are numbers), if then mutate those fields to Integer.
Regards
Bharath
And the convert
option that allows type conversion of pre-configured fields won't cut it?
Hi Magnus
Thanks for the reply. But I am aware of the convert option in CSV filter. But my question is more of auto-identifying the eligible fields for conversion to integer. Say I have a CSV with nearly 100 fields with a mix of string and number fields. Is there any generic conditional(like the following) in logstash to run through all those fields and identify number fields.
if [ field] =~ /.^/\d$./{
CSV(or mutate)
{
Convert => { [field] => "integer" }
}
}
Hope you got my question this time
Thanks
Bharath
Currently you need to write a small piece of Ruby in a ruby filter to accomplish this, but it's reasonable for the csv filter to guess the data type of the columns. I created a GitHub issue for this feature request.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.