-
New Feature
-
Resolution: Fixed
-
Minor
-
None
-
logstash plugin 2.1.0
Jenkins 2.121.1
I would like to be able to programmatically configure the logstash plugin using a groovy init hook script a la this doc.
It's pretty close to being possible – I can get as far as changing what appears in the UI under the plugin's configuration, but the configuration doesn't actually take affect (specifically, this is due to the activeIndexer value not getting updated).
Below is my init script as it stands today. This goes as far as changing the configuration in the UI, but without being able to affect the "active" indexer, I get an error: "[logstash-plugin]: Unable to instantiate LogstashIndexerDao with current configuration."
#!groovy
import jenkins.plugins.logstash.LogstashConfiguration
import jenkins.plugins.logstash.configuration.Redis
Redis indexer = new Redis()
indexer.setHost('logstash.example.com')
indexer.setPort(6379)
indexer.setKey('logstash')
LogstashConfiguration config = LogstashConfiguration.getInstance()
config.setEnabled(true)
config.setEnableGlobally(false)
config.setLogstashIndexer(indexer) // TODO: how do I get this to become the "active" indexer?
config.save()