diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index edb0ae8e6bd..81f3d944eaf 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -200,6 +200,7 @@ field. You can revert this change by configuring tags for the module and omittin - Fix `libbeat.output.write.bytes` and `libbeat.output.read.bytes` metrics of the Elasticsearch output. {issue}20752[20752] {pull}21197[21197] - The `o365input` and `o365` module now recover from an authentication problem or other fatal errors, instead of terminating. {pull}21258[21258] - Orderly close processors when processing pipelines are not needed anymore to release their resources. {pull}16349[16349] +- Fix parsing of expired licences. {issue}21112[21112] {pull}22180[22180] *Auditbeat* diff --git a/x-pack/libbeat/licenser/license.go b/x-pack/libbeat/licenser/license.go index e1c64fb314b..179c1c2f088 100644 --- a/x-pack/libbeat/licenser/license.go +++ b/x-pack/libbeat/licenser/license.go @@ -68,6 +68,11 @@ func (l *License) IsActive() bool { return l.Status == Active } +// IsExpired returns true if the licence has expired. +func (l *License) IsExpired() bool { + return l.Status == Expired +} + // IsTrial returns true if the remote cluster is in trial mode. func (l *License) IsTrial() bool { return l.Type == Trial diff --git a/x-pack/libbeat/licenser/license_test.go b/x-pack/libbeat/licenser/license_test.go index d8c8882c2fb..f21e6931e9b 100644 --- a/x-pack/libbeat/licenser/license_test.go +++ b/x-pack/libbeat/licenser/license_test.go @@ -132,6 +132,11 @@ func TestIsActive(t *testing.T) { l: License{Status: Inactive}, expected: false, }, + { + name: "expired", + l: License{Status: Expired}, + expected: false, + }, } for _, test := range tests { diff --git a/x-pack/libbeat/licenser/testdata/xpack-with-relax-expired-license-uuid.json b/x-pack/libbeat/licenser/testdata/xpack-with-relax-expired-license-uuid.json new file mode 100644 index 00000000000..9a933ca3de9 --- /dev/null +++ b/x-pack/libbeat/licenser/testdata/xpack-with-relax-expired-license-uuid.json @@ -0,0 +1,13 @@ +{ + "build": { + "hash": "053779d", + "date": "2018-07-20T05:25:16.206115Z" + }, + "license": { + "uid": "hello-license", + "type": "platinum", + "mode": "platinum", + "status": "expired", + "expiry_date_in_millis": 1588261199999 + } +} diff --git a/x-pack/libbeat/licenser/types.go b/x-pack/libbeat/licenser/types.go index 0e819275808..f0d3b64898d 100644 --- a/x-pack/libbeat/licenser/types.go +++ b/x-pack/libbeat/licenser/types.go @@ -25,11 +25,13 @@ type State int const ( Inactive State = iota Active + Expired ) var stateLookup = map[string]State{ "inactive": Inactive, "active": Active, + "expired": Expired, } var licenseLookup = map[string]LicenseType{