-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sh scripts with _bulk_action route usage examples (#101736)
- Loading branch information
1 parent
2098aec
commit 0233c89
Showing
5 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...ck/plugins/security_solution/server/lib/detection_engine/scripts/delete_rules_by_query.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License | ||
# 2.0; you may not use this file except in compliance with the Elastic License | ||
# 2.0. | ||
# | ||
|
||
set -e | ||
./check_env_variables.sh | ||
|
||
QUERY=${1} | ||
|
||
# Example delete all rules | ||
# ./delete_rules_by_query.sh | ||
|
||
# Example delete rules with tag "test" | ||
# ./delete_rules_by_query.sh 'alert.attributes.tags: \"test\"' | ||
|
||
curl -s -k \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'kbn-xsrf: 123' \ | ||
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ | ||
-X POST ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules/_bulk_action \ | ||
--data "{ | ||
\"query\": \"$QUERY\", | ||
\"action\": \"delete\" | ||
}" | jq . |
29 changes: 29 additions & 0 deletions
29
...k/plugins/security_solution/server/lib/detection_engine/scripts/disable_rules_by_query.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License | ||
# 2.0; you may not use this file except in compliance with the Elastic License | ||
# 2.0. | ||
# | ||
|
||
set -e | ||
./check_env_variables.sh | ||
|
||
QUERY=${1} | ||
|
||
# Example disable all rules | ||
# ./disable_rules_by_query.sh | ||
|
||
# Example disable rules with tag "test" | ||
# ./disable_rules_by_query.sh 'alert.attributes.tags: \"test\"' | ||
|
||
curl -s -k \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'kbn-xsrf: 123' \ | ||
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ | ||
-X POST ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules/_bulk_action \ | ||
--data "{ | ||
\"query\": \"$QUERY\", | ||
\"action\": \"disable\" | ||
}" | jq . |
29 changes: 29 additions & 0 deletions
29
...plugins/security_solution/server/lib/detection_engine/scripts/duplicate_rules_by_query.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License | ||
# 2.0; you may not use this file except in compliance with the Elastic License | ||
# 2.0. | ||
# | ||
|
||
set -e | ||
./check_env_variables.sh | ||
|
||
QUERY=${1} | ||
|
||
# Example duplicate all rules | ||
# ./duplicate_rules_by_query.sh | ||
|
||
# Example duplicate rules with tag "test" | ||
# ./duplicate_rules_by_query.sh 'alert.attributes.tags: \"test\"' | ||
|
||
curl -s -k \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'kbn-xsrf: 123' \ | ||
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ | ||
-X POST ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules/_bulk_action \ | ||
--data "{ | ||
\"query\": \"$QUERY\", | ||
\"action\": \"duplicate\" | ||
}" | jq . |
29 changes: 29 additions & 0 deletions
29
...ck/plugins/security_solution/server/lib/detection_engine/scripts/enable_rules_by_query.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License | ||
# 2.0; you may not use this file except in compliance with the Elastic License | ||
# 2.0. | ||
# | ||
|
||
set -e | ||
./check_env_variables.sh | ||
|
||
QUERY=${1} | ||
|
||
# Example enable all rules | ||
# ./enable_rules_by_query.sh | ||
|
||
# Example enable rules with tag "test" | ||
# ./enable_rules_by_query.sh 'alert.attributes.tags: \"test\"' | ||
|
||
curl -s -k \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'kbn-xsrf: 123' \ | ||
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ | ||
-X POST ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules/_bulk_action \ | ||
--data "{ | ||
\"query\": \"$QUERY\", | ||
\"action\": \"enable\" | ||
}" | jq . |
29 changes: 29 additions & 0 deletions
29
...ck/plugins/security_solution/server/lib/detection_engine/scripts/export_rules_by_query.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License | ||
# 2.0; you may not use this file except in compliance with the Elastic License | ||
# 2.0. | ||
# | ||
|
||
set -e | ||
./check_env_variables.sh | ||
|
||
QUERY=${1} | ||
|
||
# Example export all rules | ||
# ./export_rules_by_query.sh | ||
|
||
# Example export rules with tag "test" | ||
# ./export_rules_by_query.sh 'alert.attributes.tags: \"test\"' | ||
|
||
curl -s -k \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'kbn-xsrf: 123' \ | ||
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ | ||
-X POST ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules/_bulk_action \ | ||
--data "{ | ||
\"query\": \"$QUERY\", | ||
\"action\": \"export\" | ||
}" |