Skip to content

Commit 58f62c3

Browse files
fix: searchbnf.conf issue (#1860)
**Issue number:** ### PR Type **What kind of change does this PR introduce?** * [ ] Feature * [x] Bug Fix * [ ] Refactoring (no functional or API changes) * [ ] Documentation Update * [ ] Maintenance (dependency updates, CI, etc.) ## Summary ### Changes Added a `-` in searchbnf_conf.template file, to fix the issue regarding `searchbnf.conf` ### User experience As the issue is fixed, users can now avail the search assistant for their custom search command in Splunk UI. ## Checklist If an item doesn't apply to your changes, leave it unchecked. ### Review * [x] self-review - I have performed a self-review of this change according to the [development guidelines](https://splunk.github.io/addonfactory-ucc-generator/contributing/#development-guidelines) * [ ] Changes are documented. The documentation is understandable, examples work [(more info)](https://splunk.github.io/addonfactory-ucc-generator/contributing/#documentation-guidelines) * [x] PR title and description follows the [contributing principles](https://splunk.github.io/addonfactory-ucc-generator/contributing/#pull-requests) * [ ] meeting - I have scheduled a meeting or recorded a demo to explain these changes (if there is a video, put a link below and in the ticket) ### Tests See [the testing doc](https://splunk.github.io/addonfactory-ucc-generator/contributing/#build-and-test). * [x] Unit - tests have been added/modified to cover the changes * [ ] Smoke - tests have been added/modified to cover the changes * [ ] UI - tests have been added/modified to cover the changes * [x] coverage - I have checked the code coverage of my changes [(see more)](https://splunk.github.io/addonfactory-ucc-generator/contributing/#checking-the-code-coverage) **Demo/meeting:** *Reviewers are encouraged to request meetings or demos if any part of the change is unclear*
1 parent d6b58f8 commit 58f62c3

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

docs/custom_search_commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ python.version = python3
6868

6969
To generate a custom search command, the following attributes must be defined in globalConfig: `commandName`, `commandType`, `fileName`, and `arguments`. Based on the provided commandType, UCC will generate a template Python file and integrate the user-defined logic into it.
7070

71-
If `requiredSearchAssistant` is set to True, the `syntax`, `description`, and `usage` attributes are mandatory, as they are essential for generating `searchbnf.conf` file.
71+
If `requiredSearchAssistant` is set to True, the `syntax`, `description`, and `usage` attributes are mandatory, as they are essential for generating `searchbnf.conf`. For more information about these attributes please refer to the [searchbnf.conf docs](https://docs.splunk.com/Documentation/Splunk/9.4.2/Admin/Searchbnfconf)
7272

7373
**NOTE:**
7474
The user-defined Python file must include specific functions based on the command type:

splunk_add_on_ucc_framework/templates/conf_files/searchbnf_conf.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% for info in searchbnf_info -%}
2-
[{{info["command_name"]}}]
2+
[{{info["command_name"]}}-command]
33
syntax = {{info["syntax"]}}
44
description = {{info["description"]}}
55
usage = {{info["usage"]}}

tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/bin/filtercommand.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ class FiltercommandCommand(EventingCommand):
1010
"""
1111
1212
##Syntax
13-
| filtercommand contains='value1' replace='value to be replaced,value to replace with'
13+
filtercommand contains=<string> replace=<string>
1414
1515
##Description
16-
It filters records from the events stream returning only those which has :code:`contains` in them and replaces :code:`replace_array[0]` with :code:`replace_array[1]`.
16+
Filters records from the events stream.
1717
1818
"""
1919

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
[generatetextcommand]
1+
[generatetextcommand-command]
22
syntax = generatetextcommand count=<event_count> text=<string>
33
description = This command generates COUNT occurrences of a TEXT string.
44
usage = public
55

6-
[filtercommand]
7-
syntax = | filtercommand contains='value1' replace='value to be replaced,value to replace with'
8-
description = It filters records from the events stream returning only those which has :code:`contains` in them and replaces :code:`replace_array[0]` with :code:`replace_array[1]`.
6+
[filtercommand-command]
7+
syntax = filtercommand contains=<string> replace=<string>
8+
description = Filters records from the events stream.
99
usage = public

tests/testdata/test_addons/package_global_config_everything/globalConfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,7 @@
24032403
"meta": {
24042404
"name": "Splunk_TA_UCCExample",
24052405
"restRoot": "splunk_ta_uccexample",
2406-
"version": "5.67.0+f5921d36e",
2406+
"version": "5.69.0+d6b58f8c0",
24072407
"displayName": "Splunk UCC test Add-on",
24082408
"schemaVersion": "0.0.9",
24092409
"supportedThemes": [
@@ -2469,8 +2469,8 @@
24692469
"fileName": "filter.py",
24702470
"commandType": "dataset processing",
24712471
"requiredSearchAssistant": true,
2472-
"description": "It filters records from the events stream returning only those which has :code:`contains` in them and replaces :code:`replace_array[0]` with :code:`replace_array[1]`.",
2473-
"syntax": "| filtercommand contains='value1' replace='value to be replaced,value to replace with'",
2472+
"description": "Filters records from the events stream.",
2473+
"syntax": "filtercommand contains=<string> replace=<string>",
24742474
"usage": "public",
24752475
"arguments": [
24762476
{

tests/unit/generators/conf_files/test_create_searchbnf_conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_generate_conf(global_config_all_json, input_dir, output_dir):
9292
exp_fname = "searchbnf.conf"
9393
expected_content = dedent(
9494
"""
95-
[generatetextcommand]
95+
[generatetextcommand-command]
9696
syntax = generatetextcommand count=<event_count> text=<string>
9797
description = This command generates COUNT occurrences of a TEXT string.
9898
usage = public

0 commit comments

Comments
 (0)