-
Couldn't load subscription status.
- Fork 39
Send Custom Loggers to Splunk #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…Handler.isLoggable() will forward any logs from those specified sources to splunk regardless of level
|
@fengxx Can I get a review on this? |
I have a question here: does it help if one changes the log level splunk-devops-plugin/splunk-devops/src/main/java/com/splunk/splunkjenkins/JdkSplunkLogHandler.java Line 32 in b290886
splunk-devops-plugin/splunk-devops/src/main/java/com/splunk/splunkjenkins/JdkSplunkLogHandler.java Line 53 in b290886
|
|
@saper I believe we tried this and you can use it to send more logs to splunk, however, that may send all unwanted logs to Splunk. This feature would allow more granular handling of which logs to send.
|
|
@fengxx Can I get a review for this PR ? |
| && !record.getLoggerName().contains(CustomLoggersConfig.class.getName())) { // ignores self references | ||
| CustomLoggersConfig clConfig = CustomLoggersConfig.get(); | ||
| if (clConfig != null) { | ||
| for (CustomLoggerItem clItem : clConfig.getCustomLoggers()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Existing logic https://github.com/jenkinsci/splunk-devops-plugin/blob/master/splunk-devops/src/main/java/com/splunk/splunkjenkins/LoggingInitStep.java#L40
Logger.getLogger(rootLoggerName).addHandler(JdkSplunkLogHandler.LogHolder.LOG_HANDLER); registers to root logger, that means every log record will loop the config items. Assume you have 10 targets configured, and 1000 log records per second, that means 10000 additional checks even if the logger is not in the config list
| public class CustomLoggerItem implements Describable<CustomLoggerItem> { | ||
| private static final java.util.logging.Logger LOG = java.util.logging.Logger.getLogger(CustomLoggerItem.class.getName()); | ||
|
|
||
| private static transient final LogRecorderManager logRecorderManager = Jenkins.getInstance().getLog(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this depend on LogRecorderManager, which adds a https://github.com/jenkinsci/jenkins/blob/75b4b31efd3f3340805497b6b23ff4b0cb32d2f3/core/src/main/java/hudson/util/RingBufferLogHandler.java automatically, that means if you want to sent to splunk verbose level log, it has to be logged to RingBufferLogHandler too, unnecessary performance burden.
|
Thanks, but it will bring kind of performance issue. IMHO, it can be archived in other ways, as you know, Jenkins support init.groovy.d, you can add a of course you can adjust it dynamically on Jenkins script console too |
Background: Jenkins system log defaults to ignore all logs below the INFO priority level, meaning certain logs of interest aren't being sent to Splunk. Wanted a way to configure Jenkins so that certain logs are still being sent to Splunk regardless of log priority level (as this level is up to the plugin implementation and not controllable by the end user)
Adds a new section to the Splunk-Devops configuration page that allows Admins to specify any custom loggers to have their logs sent to Splunk regardless of log level.
Configuration page will have a dropdown selection that is populated by the list of configured custom loggers at <JENKINS_URL>/log/