-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Check license expiry date zero value #14591
Check license expiry date zero value #14591
Conversation
Pinging @elastic/stack-monitoring (Stack monitoring) |
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.
I tested this functionality, and it LGTM!
POST .monitoring-es-7-mb-2019.11.18/_search?filter_path=hits.hits._source.license
{
"size": 1,
"sort": [
{
"timestamp": {
"order": "desc"
}
}
],
"query": {
"term": {
"type": {
"value": "cluster_stats"
}
}
}
}
yields:
{
"hits" : {
"hits" : [
{
"_source" : {
"license" : {
"status" : "active",
"issued_to" : "elasticsearch",
"issue_date_in_millis" : 1573845929339,
"max_nodes" : 1000,
"issue_date" : "2019-11-15T19:25:29.339Z",
"start_date_in_millis" : -1,
"issuer" : "elasticsearch",
"cluster_needs_tls" : false,
"id" : "4c776e8e-8795-43f4-b74e-f0b6c1303e44",
"type" : "basic"
}
}
}
]
}
}
Co-Authored-By: kaiyan-sheng <kaiyan.sheng@elastic.co>
…beats into bugfix-mb-es-license-expiry
@@ -82,7 +82,7 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error { | |||
if ccrUnavailableMessage != "" { | |||
if time.Since(m.lastCCRLicenseMessageTimestamp) > 1*time.Minute { | |||
m.lastCCRLicenseMessageTimestamp = time.Now() | |||
m.Logger().Warn(ccrUnavailableMessage) | |||
m.Logger().Debug(ccrUnavailableMessage) |
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.
I made this change for two reasons:
-
It's consistent with a similar logging behavior seen in the
elasticsearch/enrich
metricset:m.Logger().Debug(enrichUnavailableMessage) -
By changing the log level to debug here (instead of warn), this check in the system test doesn't fail:
self.assert_no_logged_warnings()
@kaiyan-sheng Thanks for the review. I had to make a couple of changes to the PR since your review to make the system test pass. Would you mind re-reviewing, please? Thanks! |
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.
LGTM, thanks for explaining the change from warn to debug.
Travis CI is green and Jenkins CI failures are unrelated. Merging. |
* Check license expiry date zero value (#14591) * Check license expiry date zero value * Adding check to system test * Refactoring: moving fix to better location in code * Adding CHANGELOG entry * Fixing typo Co-Authored-By: kaiyan-sheng <kaiyan.sheng@elastic.co> * Change CCR log message to debug * Start basic license * Fixing up CHANGELOG
* Check license expiry date zero value (#14591) * Check license expiry date zero value * Adding check to system test * Refactoring: moving fix to better location in code * Adding CHANGELOG entry * Fixing typo Co-Authored-By: kaiyan-sheng <kaiyan.sheng@elastic.co> * Change CCR log message to debug * Start basic license * Fixing up CHANGELOG
* Check license expiry date zero value (#14591) * Check license expiry date zero value * Adding check to system test * Refactoring: moving fix to better location in code * Adding CHANGELOG entry * Fixing typo Co-Authored-By: kaiyan-sheng <kaiyan.sheng@elastic.co> * Change CCR log message to debug * Start basic license * Fixing up CHANGELOG * Adding blank line * Fixing up code * Updating license URLs * Fixing up CHANGELOG * Adding existence check for type field in doc
…4604) * Check license expiry date zero value (elastic#14591) * Check license expiry date zero value * Adding check to system test * Refactoring: moving fix to better location in code * Adding CHANGELOG entry * Fixing typo Co-Authored-By: kaiyan-sheng <kaiyan.sheng@elastic.co> * Change CCR log message to debug * Start basic license * Fixing up CHANGELOG
Resolves #14541.
Users using Metricbeat to monitor an Elasticsearch cluster with a Basic license will not be able to access that cluster in the Stack Monitoring UI. This is because the
elasticsearch/cluster_stats
metricset is recording a Basic license's expiration date as0
, which the UI considers to a sentinel value for an expired license.This PR fixes this bug by not recording the expiration date field at all, if its value is
0
. This mimics what internal monitoring collection is doing.Testing this PR
elasticsearch-xpack
Metricbeat module..monitoring-es-*-mb-*
oftype: cluster_stats
does not record the license expiration date in ms.