Hi everyone,
I used the following Logstash configuration, but sometimes Logstash auto generates the column names from the CSV file, and sometimes its not (According to the pictures). Could you please clarify what is the issue here?
ruby {
code => 'event.set("[@metadata][fields]", 1 + event.get("message").count(","))'
}
if [@metadata][fields] > 2 {
mutate {
gsub => [
"message", "[\"\"/\r]", ""
]
}
csv {
separator => ","
autodetect_column_names => true
autogenerate_column_names => true
}
mutate {
convert => {
"percent_compressed" => "integer"
"rosbagTimestamp" => "integer"
"secs" => "integer"
"status" => "integer"
"stamp" => "integer"
"goal_id" => "integer"
"duration_time" => "float"
"percent_uploaded" => "integer"
"seq" => "integer"
"nsecs" => "integer"
# "total_space" => "integer"
# "free_space" => "integer"
# "used_space" => "integer"
}
}
}
Without column names:
With column names:
Note:
The JSON output pictures might not be the same. However, they come from the same CSV file.