How to dynamically add a column in the output and manipulate the date

How can i dynamically pass the date in the query 'Statment' and also use the same date as a output column?

I want the date to be 2 days behind the execution date

input {
jdbc {
jdbc_driver_library => "sqljdbc42.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_connection_string => "*******"
jdbc_user => '
'
jdbc_password => '
'
schedule => "
* * * *"
statement => " EXEC PROCEDURE_NAME @date = '20170928' "
}
}
filter {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}"}
}
date {
match => [ "@timestamp", "ISO8601" ]
}
}
output {
stdout { codec => rubydebug }
influxdb {
allow_time_override => 'true'
data_points => { "time" => "@timestamp" }
send_as_tags => ["account_name"]
use_event_fields_for_data_points => true
host => "localhost"
}
}

You could pass the desired date as an environment variable and reference that in your plugins.

https://www.elastic.co/guide/en/logstash/current/environment-variables.html

Ok but i want it to change everyday like if its '5th Oct' then I want the value of the variable to be '3rd Oct' and i want it to be updated everyday. Is there a way I can do this?

Not without restarting Logstash, no.

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