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

Examples do not work in distributed search #418

Closed
Bre77 opened this issue Nov 24, 2021 · 8 comments
Closed

Examples do not work in distributed search #418

Bre77 opened this issue Nov 24, 2021 · 8 comments

Comments

@Bre77
Copy link
Contributor

Bre77 commented Nov 24, 2021

The example code for Streaming Search commands, does not work in a distributed search environment, because the %app%/lib directory is not included in bundle replication.

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "lib"))

The lib directory needs to instead be located inside bin, or a distsearch.conf should be included, or I guess a note about it has to be installed on the indexers just so it has access to Splunklib.

@vmalaviya-splunk
Copy link
Contributor

vmalaviya-splunk commented Nov 30, 2021

Hey @Bre77
We'll need a couple of details to reproduce the issue.

  1. Splunk version
  2. Steps to create a replica of your distributed environment.

@Bre77
Copy link
Contributor Author

Bre77 commented Nov 30, 2021

Hey @Bre77
We'll need a couple of details to reproduce the issue.

  1. Splunk version
  2. Steps to create a replica of your distributed environment.

I have tested this in both the current Splunk Cloud version and the latest Splunk Enterprise version. My distributed environment was an index cluster with the TA only installed on the search head.

Issue can easily be reproduced by installing any version 0.1.x of https://splunkbase.splunk.com/app/6161/ on a search head with distributed search. I fixed this issue in 1.0.0 by moving the lib directory inside bin.

@Bre77
Copy link
Contributor Author

Bre77 commented Dec 6, 2021

@tacole02
Copy link

tacole02 commented Dec 9, 2021

Thanks so much for raising this issue, @Bre77

The correct solution is so include a distsearch.conf file with the /lib directory added to the replication allow list.

@bparmar-splunk
Copy link
Contributor

Hi @Bre77,
We have tried to reproduce this issue (using docker) with architecture mentioned below:

  • Splunk latest
  • 3 search heads
  • 3 indexers

We have installed (.tar of) searchcommands_app (comprises of several custom search commands) located in python-sdk repo.
All custom commands are tested and working fine. We could not encounter any issue while testing.
App directory structure used here as:

searchcommands_app/

bin/
data/
default/
lib/ (Contains splunklib folder)
lookups/
metadata/
README/
searchcommands_app.log

Please let us know, if we missed anything.

@Bre77
Copy link
Contributor Author

Bre77 commented Dec 24, 2021

@bparmar-splunk where was the search command installed in your test? Only Search Heads or on the indexers too?

@bparmar-splunk
Copy link
Contributor

@Bre77,
We have tested using virtual infrastructure of above mentioned configuration and search command was installed on all nodes.
We have verified on all nodes using Splunk Web UI and it was working fine.

@Bre77
Copy link
Contributor Author

Bre77 commented Dec 28, 2021

@bparmar-splunk thats why you couldn't reproduce. Try installing a streaming search command only on the search head. It will be distributed to the indexers in the knowledge bundle, but be missing the splunklib directory because the provided example does not include a distsearch.conf as per the Splunk Dev docs: https://dev.splunk.com/enterprise/docs/devtools/customsearchcommands/packageanddeploycustom/#Deploy-a-streaming-command-on-an-indexer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants