Conditions in logstash

Hey everyone,

i have two fileds in a csv file dump_status and upload_status then i added a third field called return_code. the values of upload_status and dump_status are copy complete and
copy failed. what i need to is the assign 1 to return code when the two fields have copy complete as value and 0 to other conditions. here's my filter:

filter {
if [type] == "test_parser" {

csv {
    columns => ["dump","dump-status","copy","upload","up_status"]
    separator => ";"
    remove_field => ["dump","upload"]
    add_field => { "tech_return_code" => "-" }
}

if ([dump_status] == "Copy complete" and [up_status] == "Copy complete") {

mutate {
gsub => [ "tech_return_code" , "-" , "1" ]
}}
if ([dump_status] != "Copy complete" or [up_status] != "Copy complete") {

mutate {
gsub => [ "tech_return_code" , "-" , "0" ]
}}

mutate {
    convert => [ "tech_return_code" , "integer" ]
}

}}

it didn't worked when i am testing it with the 4 cases any help please

thanks!

What does an example event look like? Use a stdout { codec => rubydebug } output to dump the raw event.

i cannot run logstash in debug mode there is a problem in java path although i tried to export JAVA_HOME to its right path but it didn't work although i tried

output {stdout { codec => rubydebug }} it didn't work. is my filter syntax correct?
i am using logstash version 2.3.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.