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

Updated README with app level index routing #292

Merged
merged 6 commits into from
Oct 1, 2021
Merged

Conversation

hvaghani221
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@luckyj5 luckyj5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets also add that "ADD_APP_INFO" (cache info) is required to be enabled for per app index routing feature.
If Add-app-info is not enabled, nozzle will not have app's metadata which will include SPLUNK_INDEX value.


You can also update the env on the fly using cf-cli command:
```
cf set-env <APP_NAME> SPLUNK_INDEX <ENV_VAR_VALUE>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for this, if you set-env via CLI, you still need to restage the application for those updated envs to take effect. Please cross check. Thanks!

Copy link
Collaborator Author

@hvaghani221 hvaghani221 Sep 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for this, if you set-env via CLI, you still need to restage the application for those updated envs to take effect. Please cross check. Thanks!

In my testing, I was able to route data-gen events to the index provided using cf command. I tested following scenarios:

  • deployed data_gen without setting SPLUNK_INDEX env variable and set env after it is deployed
  • deployed data_gen with setting SPLUNK_INDEX env variable and update env with new index value

In both cases, event were ingested in newly specified index.

I think, if the app is using the environment variable then we are required to restage the application. For our use case, app doesn't rely on SPLUNK_INDEX, so no need to restage. Cloud controller endpoint will always returns latest env data. So as long as connector is invalidating app cache, it should be fine

@hvaghani221
Copy link
Collaborator Author

hvaghani221 commented Sep 27, 2021

Lets also add that "ADD_APP_INFO" (cache info) is required to be enabled for per app index routing feature.
If Add-app-info is not enabled, nozzle will not have app's metadata which will include SPLUNK_INDEX value.

It doen't depend on ADD_APP_INFO config. As you can see in router, as long as event has app_id, it will call event.AnnotateWithAppData method.
In event.AnnotateWithAppData method, it gets app information from cache from cf_app_id. If it find's SPLUNK_INDEX in app env, it'll add info_splunk_index field in the event

@hvaghani221 hvaghani221 requested a review from luckyj5 September 27, 2021 05:56
@luckyj5
Copy link
Collaborator

luckyj5 commented Sep 28, 2021

Lets also add that "ADD_APP_INFO" (cache info) is required to be enabled for per app index routing feature.
If Add-app-info is not enabled, nozzle will not have app's metadata which will include SPLUNK_INDEX value.

It doen't depend on ADD_APP_INFO config. As you can see in router, as long as event has app_id, it will call event.AnnotateWithAppData method. In event.AnnotateWithAppData method, it gets app information from cache from cf_app_id. If it find's SPLUNK_INDEX in app env, it'll add info_splunk_index field in the event

ADD_APP_INFO config triggers nozzle to fetch cache info for apps. If it's not selected, then nozzle won't have cache info, which means it won't have env variables either. Let me know if it's otherwise.

@hvaghani221
Copy link
Collaborator Author

hvaghani221 commented Sep 29, 2021

Lets also add that "ADD_APP_INFO" (cache info) is required to be enabled for per app index routing feature.
If Add-app-info is not enabled, nozzle will not have app's metadata which will include SPLUNK_INDEX value.

It doen't depend on ADD_APP_INFO config. As you can see in router, as long as event has app_id, it will call event.AnnotateWithAppData method. In event.AnnotateWithAppData method, it gets app information from cache from cf_app_id. If it find's SPLUNK_INDEX in app env, it'll add info_splunk_index field in the event

ADD_APP_INFO config triggers nozzle to fetch cache info for apps. If it's not selected, then nozzle won't have cache info, which means it won't have env variables either. Let me know if it's otherwise.

On further analysis, found that boltdb cache is initialised only if ADD_APP_INFO is enabled otherwise NoCache is initialised. And app info will never be fetched from remote.
I'll make changes according to that.
Thanks.

README.md Outdated
Index routing is a feature that can be used to send different Cloud Foundry logs to different indexes for better ACL and data retention control in Splunk.

#### Per application index routing via application manifest
### Per application index routing via application manifest
To enable per app index routing, you are required to set environmt variable `SPLUNK_INDEX`in your application and enable ADD_APP_INFO(Select at least one metadata) to enable app info caching. Make sure that given HEC token can ingest events to the SPLUNK_INDEX.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update as below:

To enable per application index routing:

  • Please set environment variable SPLUNK_INDEX in your application's manifest (example below - link to the example)
  • Make sure Splunk nozzle is configured with ADD_APP_INFO (Select at least one of AppName, OrgName/Id, SpaceName/id) to enable app info caching
  • Make sure SPLUNK_INDEX specified in app's manifest exist in Splunk and can receive data for the configured Splunk HEC token.

@luckyj5
Copy link
Collaborator

luckyj5 commented Sep 30, 2021

Thanks for the update @harshit-splunk.

Copy link
Collaborator

@luckyj5 luckyj5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed this - note for SPLUNK_VERSION
Please remove this as well.

Copy link
Collaborator

@luckyj5 luckyj5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luckyj5 luckyj5 merged commit 2bebecf into develop Oct 1, 2021
@luckyj5 luckyj5 deleted the readme-docs-update branch October 1, 2021 21:00
luckyj5 added a commit that referenced this pull request Oct 14, 2021
* update docs (#276)

* Update Go version and migrate to Go modules (#287)

* Adding go.mod and go.sum to migrate to Go modules from Glide

* Removed old Vendor folder after migrating to Go modules

* Adding new Vendor folder after migrating to Go mudules

* Removed Glide files, references in readme and updated CI/CD

* Migrated from bolt to bbolt for cache module to resolve race issue

* Added tags from the envelope to the events

* Updated tile.yml with new config

* Updated README

* Updated migration script to prevent unnecessary migration (#288)

* Updated cache.GetApp logic to retrieve app info from boltdb database as well

* Bugfix/disconnect due to slow consumer event drop (#289)

* dropping events when the queue is full

* Corrected the newly added test case with data race condition

* minor change in logging

* added event drop warning threshold in config

* minor update in the logging

* Updated comments and log info

* Trimmed white space for ApiEndPoint and SplunkHost

* Updated docs with required field & optional value

* Added default value in README

* Updated events doc

* Removed SPLUNK_VERSION config as not needed anymore

* Removed SplunkVersion from eventsink.splunk_test

* Updated README with app level index routing (#292)

* Updated README with app level index routing

* Removed unnecessary changes

* added required config to enable index routing

* updated index routing doc

* added warning in index routing docs

* upgraded module version

* upgraded gogo/protobuf version

* executed go mod tidy

* upgraded indirect dependency

* updated version in a build example in readme

* Corrected index routing docs

* Added more details (#299)

* Updated docs around

- Add Tags: Performance impact of adding tags in events
- How to detect slow downstream related issues and event drops

* added 'drop_warn_threshold' config in tile (#300)

Co-authored-by: Matthew Heidemann <[email protected]>
Co-authored-by: Shubham Jain <[email protected]>
Co-authored-by: harshit-splunk <[email protected]>
Co-authored-by: harshit-splunk <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants