I am using this filter to parse some csv data that I am generating from a php file. I am taking the output from a gpu monitoring tool called msi afterburner which outputs a .hml file. There are a tonne of white spaces and an irrelevant header which my php file removes and outputs comma separated value.
filter
{
csv
{
columns => ["somename","@timestamp","cpu.avg.temp","gpu.temp","fan.speed","gpu.usage","bus.usage","fan.tachometer","clock.core","framerate.hz","framerate.ms","cpu.temp.1","cpu.temp.2","cpu.temp.3","cpu.temp.4"]
separator => ","
skip_empty_columns => "true"
}
mutate
{
convert => ["somename","integer"]
convert => ["cpu.avg.temp","float"]
convert => ["gpu.temp","float"]
convert => ["fan.speed","float"]
convert => ["gpu.usage","float"]
convert => ["bus.usage","float"]
convert => ["fan.tachometer","float"]
convert => ["clock.core", "float"]
convert => ["framerate.hz","float"]
convert => ["framerate.ms","float"]
convert => ["cpu.temp.1","float"]
convert => ["cpu.temp.2","float"]
convert => ["cpu.temp.3","float"]
convert => ["cpu.temp.4","float"]
}
date
{
match => ["@timestamp", "dd-MM-yyyyHH:mm:ss"]
}
}
This is the output logstash is throwing at me. I am wondering if this is due to the fact that my date format is bad or if at the end of my message there appears to be a special character '\r'. I am wondering if logstash is even able to read dd-MM-yyyyHH:mm:ss format where year and hour are stuck together, if not I might be in a bit of trouble.
{
"path" => "C:\\Users\\Public\\Documents\\gpumetrics.csv",
"somename" => 80,
"@timestamp" => 2017-02-20T02:33:10.764Z,
"@version" => "1",
"host" => "DESKTOP-Q8UEATO",
"message" => "80,19-02-201721:33:10,32.000,41.000,0.000,0.000,0.000,0.000,215.000,0.000,0.000,31.000,32.000,30.000,31.000\r",
"type" => "csv",
"tags" => [
[0] "_csvparsefailure",
[1] "_dateparsefailure"
]
}
Here are a few sample lines from my log file. As you may notice, there is a field before timestamp. I am wondering if this is allowed.
80,19-02-201713:20:32,44.000,43.000,0.000,0.000,0.000,0.000,215.000,,,37.000,42.000,41.000,38.000
80,19-02-201713:20:33,47.000,43.000,0.000,0.000,0.000,0.000,215.000,,,46.000,47.000,45.000,44.000
80,19-02-201713:20:34,53.000,43.000,0.000,0.000,0.000,0.000,215.000,,,35.000,50.000,36.000,37.000
80,19-02-201713:20:35,37.000,43.000,0.000,0.000,0.000,0.000,215.000,,,37.000,37.000,37.000,34.000
80,19-02-201713:20:36,34.000,44.000,0.000,0.000,0.000,0.000,1582.000,0.000,0.000,39.000,34.000,33.000,36.000
80,19-02-201713:20:37,46.000,44.000,0.000,0.000,0.000,0.000,1582.000,0.000,0.000,45.000,37.000,43.000,37.000
Your problem can be solved very simply by changing the name of your timestamp variable since
@timestamp
is created internally before your line is parsed.