Skip to content

Commit

Permalink
Merge pull request #1364 from nsano-rururu/kibana_discover812
Browse files Browse the repository at this point in the history
Kibana Discover support kibana 8.12
  • Loading branch information
jertel authored Jan 29, 2024
2 parents 1e418d7 + 4d38d69 commit 0191544
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- [IRIS] Fix schema.yaml(iris_url to iris_host) - [#1346](https://github.com/jertel/elastalert2/pull/1346) - @nsano-rururu
- [IRIS] Fix issue with document with nested json inside. See [#1348](https://github.com/jertel/elastalert2/discussions/1348) - [#1352](https://github.com/jertel/elastalert2/pull/1352) - @malinkinsa
- [Docs] Clarify `jinja_template_path` documentation - [20a05f9](https://github.com/jertel/elastalert2/commit/20a05f995f566f8719d6e4bf7b8a3977c7ab9e23) - @jertel
- Add support for Kibana 8.12 for Kibana Discover - [#1364](https://github.com/jertel/elastalert2/pull/1364) - @nsano-rururu

# 2.15.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 @@ -744,7 +744,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.5`, `8.6`, `8.7`, `8.8`, `8.9` , `8.10` , `8.11`
- `8.0`, `8.1`, `8.2`, `8.3`, `8.4`, `8.5`, `8.6`, `8.7`, `8.8`, `8.9` , `8.10` , `8.11` , `8.12`

``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.5', '8.6', '8.7', '8.8', '8.9', '8.10', '8.11'
'8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6', '8.7', '8.8', '8.9', '8.10', '8.11', '8.12'
])

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 @@ -296,7 +296,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.11', '8.10', '8.9', '8.8', '8.7', '8.6', '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_version: {type: string, enum: ['8.12','8.11', '8.10', '8.9', '8.8', '8.7', '8.6', '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 @@ -34,7 +34,8 @@
'8.8',
'8.9',
'8.10',
'8.11'
'8.11',
'8.12'
])
def test_generate_kibana_discover_url_with_kibana_7x(kibana_version):
url = generate_kibana_discover_url(
Expand Down Expand Up @@ -72,7 +73,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': '620ad0e6-43df-4557-bda2-384960fa9086',
'timestamp_field': 'timestamp'
},
Expand Down Expand Up @@ -118,7 +119,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'logs',
'timestamp_field': 'timestamp',
'name': 'test'
Expand All @@ -134,7 +135,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.11',
'kibana_discover_version': '8.12',
'timestamp_field': 'timestamp',
'name': 'test'
},
Expand Down Expand Up @@ -168,7 +169,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'd6cabfb6-aaef-44ea-89c5-600e9a76991a',
'timestamp_field': 'timestamp'
},
Expand Down Expand Up @@ -200,7 +201,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'd6cabfb6-aaef-44ea-89c5-600e9a76991a',
'kibana_discover_from_timedelta': timedelta(hours=1),
'timestamp_field': 'timestamp'
Expand Down Expand Up @@ -233,7 +234,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.11',
'kibana_discover_version': '8.12',
'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 @@ -267,7 +268,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'd6cabfb6-aaef-44ea-89c5-600e9a76991a',
'kibana_discover_to_timedelta': timedelta(hours=1),
'timestamp_field': 'timestamp'
Expand Down Expand Up @@ -300,7 +301,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.11',
'kibana_discover_version': '8.12',
'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 @@ -334,7 +335,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'd6cabfb6-aaef-44ea-89c5-600e9a76991a',
'timeframe': timedelta(minutes=20),
'timestamp_field': 'timestamp'
Expand Down Expand Up @@ -367,7 +368,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'logs-*',
'kibana_discover_columns': ['level', 'message'],
'timestamp_field': 'timestamp'
Expand Down Expand Up @@ -400,7 +401,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'filter': [
Expand Down Expand Up @@ -451,7 +452,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': '90943e30-9a47-11e8-b64d-95841ca0b247',
'timestamp_field': 'timestamp',
'filter': [
Expand Down Expand Up @@ -505,7 +506,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'query_key': 'geo.dest'
Expand Down Expand Up @@ -565,7 +566,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'query_key': 'geo.dest'
Expand Down Expand Up @@ -627,7 +628,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'query_key': 'status'
Expand Down Expand Up @@ -677,7 +678,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'query_key': 'status'
Expand Down Expand Up @@ -726,7 +727,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'compound_query_key': ['geo.src', 'geo.dest'],
Expand Down Expand Up @@ -814,7 +815,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'filter': [
Expand Down Expand Up @@ -891,7 +892,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.11',
'kibana_discover_version': '8.12',
'kibana_discover_index_pattern_id': 'logs-*',
'timestamp_field': 'timestamp',
'filter': [
Expand Down

0 comments on commit 0191544

Please sign in to comment.