Hi
I use a CSV (and the logstash csv filter) and with one field I need to create a id based on this php code where $siren value is in my csv (named SIREN, for example 010441582), notice the use of php modulo (%)
return "FR" . (( 12 + 3 * ( $siren % 97 ) ) % 97 ) . $siren;
I try to do this with logstash
filter {
csv {
columns => [
"SIREN","NIC"
]
separator => ","
}
ruby {
code => "
event.set('TVA_id', (( 12 + 3 * ( event.get('SIREN') % 97 ) ) % 97 ))
"
}
mutate {
add_field => {
"TVA" => "FR%{TVA_id}%{SIREN}"
}
}
}
This code failed to work, related to the code in the ruby part... If you have some clue or solution thanks in advance!