Our files are in CSV format but each line can be of a different record type. For example:
f1,f2,f3
g1,g2,g3,g4,g5
h1,h2,h3,h4
Record type can be determined by examining the value of the first field. How do I write a CSV filter for this?
Our files are in CSV format but each line can be of a different record type. For example:
f1,f2,f3
g1,g2,g3,g4,g5
h1,h2,h3,h4
Record type can be determined by examining the value of the first field. How do I write a CSV filter for this?
You could use a conditional to take a peek at the line and based on that choose between different csv filters.
if [message] =~ /^some pattern/ {
csv {
...
}
} else if [message] =~ /^other pattern/ {
csv {
...
}
}
Thanks for the elegant solution. I will give this a try
© 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.