Hello All,
I'm stuck in how to implement conditional check in logstash and how would it be implemented correctly.
Usecase:I have data coming in my index with multiple fields value,I'd like to send data to elastic
where the timesatmp field value should be replaced with last_execution timestamp value,this is achieved ,and should only be done if jobStatus.jobId this field exist.
How to implement entirely sudo code:
if(jobid field exist)
then
replace timestamp filed value with last_execution timestamp.
Ruby partial code is done but not sure entirely.
ruby {
code => "event.set('@timestamp', event.get('last_execution_time'));"
}
config:
input {
exec {
command => '. ../scripts/ordermonitor/run_ordermonitor.sh'
schedule => "0 0 * * * *"
}
}
filter {
ruby {
code => "event.set('@timestamp', event.get('last_execution_time'));"
}
}
output {
elasticsearch {
hosts => "http://abc.com:9200"
ilm_pattern => "{now/d}-000001"
ilm_rollover_alias => "tix-monitor-order"
ilm_policy => "tix-monitor-order-policy"
doc_as_upsert => true
document_id => "%{[order][recordUniqueId]}"
}
}
Assuming this would be part of ruby code,if yes then should it be part of filter plugin?
Below is partial implementation of config file,would like to achieve mentioned above.
Thanx