Skip to content
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

Kibana Discover support kibana 8.5 #993

Merged
merged 2 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
## Other changes
- Upgrade pylint 2.15.3 to 2.15.5, pytest 7.1.3 to 7.2.0, pytest-xdist 2.5.0 to 3.0.2, sphinx 5.2.3 to 5.3.0, tox 3.26.0 to 3.27.0 - [#988](https://github.com/jertel/elastalert2/pull/988) - @nsano-rururu
- Upgrade to Python 3.11 - [#989](https://github.com/jertel/elastalert2/pull/989) - @jertel
- Add support for Kibana 8.5 for Kibana Discover - [#993](https://github.com/jertel/elastalert2/pull/993) - @nsano-rururu

# 2.8.0

Expand Down
2 changes: 1 addition & 1 deletion docs/source/ruletypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ kibana_discover_version
The currently supported versions of Kibana Discover are:

- `7.0`, `7.1`, `7.2`, `7.3`, `7.4`, `7.5`, `7.6`, `7.7`, `7.8`, `7.9`, `7.10`, `7.11`, `7.12`, `7.13`, `7.14`, `7.15`, `7.16`, `7.17`
- `8.0`, `8.1`, `8.2`, `8.3`, `8.4`
- `8.0`, `8.1`, `8.2`, `8.3`, `8.4`, `8.5`

``kibana_discover_version: '7.15'``

Expand Down
2 changes: 1 addition & 1 deletion elastalert/kibana_discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

kibana_versions = frozenset([
'7.0', '7.1', '7.2', '7.3', '7.4', '7.5', '7.6', '7.7', '7.8', '7.9', '7.10', '7.11', '7.12', '7.13', '7.14', '7.15', '7.16', '7.17',
'8.0', '8.1', '8.2', '8.3', '8.4'
'8.0', '8.1', '8.2', '8.3', '8.4', '8.5'
])

def generate_kibana_discover_url(rule, match):
Expand Down
2 changes: 1 addition & 1 deletion elastalert/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ properties:
generate_kibana_discover_url: {type: boolean}
shorten_kibana_discover_url: {type: boolean}
kibana_discover_app_url: {type: string}
kibana_discover_version: {type: string, enum: ['8.4', '8.3', '8.2', '8.1', '8.0', '7.17', '7.16', '7.15', '7.14', '7.13', '7.12', '7.11', '7.10', '7.9', '7.8', '7.7', '7.6', '7.5', '7.4', '7.3', '7.2', '7.1', '7.0']}
kibana_discover_version: {type: string, enum: ['8.5', '8.4', '8.3', '8.2', '8.1', '8.0', '7.17', '7.16', '7.15', '7.14', '7.13', '7.12', '7.11', '7.10', '7.9', '7.8', '7.7', '7.6', '7.5', '7.4', '7.3', '7.2', '7.1', '7.0']}
kibana_discover_index_pattern_id: {type: string, minLength: 1}
kibana_discover_columns: {type: array, items: {type: string, minLength: 1}, minItems: 1}
kibana_discover_from_timedelta: *timedelta
Expand Down
41 changes: 21 additions & 20 deletions tests/kibana_discover_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
'8.1',
'8.2',
'8.3',
'8.4'
'8.4',
'8.5'
])
def test_generate_kibana_discover_url_with_kibana_7x(kibana_version):
url = generate_kibana_discover_url(
Expand Down Expand Up @@ -65,7 +66,7 @@ def test_generate_kibana_discover_url_with_relative_kibana_discover_app_url():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'app/discover#/',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': '620ad0e6-43df-4557-bda2-384960fa9086',
'timestamp_field': 'timestamp'
},
Expand Down Expand Up @@ -111,7 +112,7 @@ def test_generate_kibana_discover_url_with_missing_kibana_discover_version():
def test_generate_kibana_discover_url_with_missing_kibana_discover_app_url():
url = generate_kibana_discover_url(
rule={
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'logs',
'timestamp_field': 'timestamp',
'name': 'test'
Expand All @@ -127,7 +128,7 @@ def test_generate_kibana_discover_url_with_missing_kibana_discover_index_pattern
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'timestamp_field': 'timestamp',
'name': 'test'
},
Expand Down Expand Up @@ -161,7 +162,7 @@ def test_generate_kibana_discover_url_with_kibana_discover_app_url_env_substitut
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://$KIBANA_HOST:$KIBANA_PORT/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'd6cabfb6-aaef-44ea-89c5-600e9a76991a',
'timestamp_field': 'timestamp'
},
Expand Down Expand Up @@ -193,7 +194,7 @@ def test_generate_kibana_discover_url_with_from_timedelta():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'd6cabfb6-aaef-44ea-89c5-600e9a76991a',
'kibana_discover_from_timedelta': timedelta(hours=1),
'timestamp_field': 'timestamp'
Expand Down Expand Up @@ -226,7 +227,7 @@ def test_generate_kibana_discover_url_with_from_timedelta_and_timeframe():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'd6cabfb6-aaef-44ea-89c5-600e9a76991a',
'kibana_discover_from_timedelta': timedelta(hours=1),
'timeframe': timedelta(minutes=20),
Expand Down Expand Up @@ -260,7 +261,7 @@ def test_generate_kibana_discover_url_with_to_timedelta():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'd6cabfb6-aaef-44ea-89c5-600e9a76991a',
'kibana_discover_to_timedelta': timedelta(hours=1),
'timestamp_field': 'timestamp'
Expand Down Expand Up @@ -293,7 +294,7 @@ def test_generate_kibana_discover_url_with_to_timedelta_and_timeframe():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'd6cabfb6-aaef-44ea-89c5-600e9a76991a',
'kibana_discover_to_timedelta': timedelta(hours=1),
'timeframe': timedelta(minutes=20),
Expand Down Expand Up @@ -327,7 +328,7 @@ def test_generate_kibana_discover_url_with_timeframe():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'd6cabfb6-aaef-44ea-89c5-600e9a76991a',
'timeframe': timedelta(minutes=20),
'timestamp_field': 'timestamp'
Expand Down Expand Up @@ -360,7 +361,7 @@ def test_generate_kibana_discover_url_with_custom_columns():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'logs-*',
'kibana_discover_columns': ['level', 'message'],
'timestamp_field': 'timestamp'
Expand Down Expand Up @@ -393,7 +394,7 @@ def test_generate_kibana_discover_url_with_single_filter():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'filter': [
Expand Down Expand Up @@ -444,7 +445,7 @@ def test_generate_kibana_discover_url_with_multiple_filters():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': '90943e30-9a47-11e8-b64d-95841ca0b247',
'timestamp_field': 'timestamp',
'filter': [
Expand Down Expand Up @@ -498,7 +499,7 @@ def test_generate_kibana_discover_url_with_int_query_key():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'query_key': 'geo.dest'
Expand Down Expand Up @@ -558,7 +559,7 @@ def test_generate_kibana_discover_url_with_str_query_key():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'query_key': 'geo.dest'
Expand Down Expand Up @@ -620,7 +621,7 @@ def test_generate_kibana_discover_url_with_null_query_key_value():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'query_key': 'status'
Expand Down Expand Up @@ -670,7 +671,7 @@ def test_generate_kibana_discover_url_with_missing_query_key_value():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'query_key': 'status'
Expand Down Expand Up @@ -719,7 +720,7 @@ def test_generate_kibana_discover_url_with_compound_query_key():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'compound_query_key': ['geo.src', 'geo.dest'],
Expand Down Expand Up @@ -807,7 +808,7 @@ def test_generate_kibana_discover_url_with_filter_and_query_key():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'filter': [
Expand Down Expand Up @@ -884,7 +885,7 @@ def test_generate_kibana_discover_url_with_querystring_filter_and_query_key():
url = generate_kibana_discover_url(
rule={
'kibana_discover_app_url': 'http://kibana:5601/#/discover',
'kibana_discover_version': '8.4',
'kibana_discover_version': '8.5',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'filter': [
Expand Down