Configure Splunk Firehose Nozzle Release as a Cloud Foundry application
You can configure the splunk-firehose-nozzle community application to send your Cloud Foundry Enterprise Environment component metrics, application logs, and application metrics to Splunk.
Before you install the Splunk Firehose Nozzle app, you must install Splunk in a container. If you have not installed Splunk, you can install it by using Docker. If you already use Splunk, you can configure the Splunk add-on for Cloud Foundry through the Splunk Marketplace.
Installing Splunk
- Install Docker. For more information, see Install Docker
.
-
Pull the Splunk images from Docker Hub.
docker pull splunk/splunk -
Start Splunk:
docker run -d -e "SPLUNK_START_ARGS=--accept-license" -e "SPLUNK_USER=root" -p "8000:8000" -p "8088:8088" splunk/splunkIn this example, 8000 represents the default port where the Splunk dashboard is running and 8088 is the HTTP Event Collector port that receives the logs from the nozzle.
-
To verify that Splunk is running, open
http://localhost:8000in your browser and log in. The default user name isadmin, and the default password ischangeme.
Installing the Splunk add-on for Cloud Foundry
-
Clone the latest Splunk add-on for Cloud Foundry by running the following command:
git clone git@github.com:splunk/splunk-addon-for-cloud-foundry.git -
Retrieve the Docker containerId for Splunk by running the following command:
docker ps -aqf "ancestor=splunk/splunk" -
Copy the
Splunk\_SA\_CloudFoundryfolder that you cloned to the Docker container by running the following command:docker cp splunk-addon-for-cloud-foundry/Splunk_SA_CloudFoundry <containerId>:/opt/splunk/etc/apps
Note: Use the <containerId> value for Splunk that you obtained in step 2.
-
Restart the Docker container.
docker restart <containerId> -
Open the Splunk dashboard at
http://localhost:8000. If the add-on installed successfully, you see new icon with the title Splunk add-on for Cloud Foundry.
Configuring the Splunk HTTP event collector
Use the Splunk HTTP Event Collector to send data from HTTP to Splunk. In this case, you can send Cloud Foundry system logs.
- In the Splunk dashboard, Click Settings > Data inputs
- In the HTTP Event Collector section, click Add new.
- Enter a name for the data input, and click Next.
- In the Source type list, select Automatic.
- For the Index, either select an existing index, such as Default, or create a new one.
- Click Review and then Submit.
- Save the Generated Token Value.
- Enable the HTTP Event Collector:
- Click Settings > Data inputs.
- Click HTTP Event Collector.
- Click Global Settings.
- In the All Tokens section, click Enabled, and then Save
- Splunk is now ready receive logs through HTTP by using port 8088. Note: If you want to use a different port, you can specify its value in the Global Settings.
Configuring and deploying the Splunk Firehose Nozzle release application
-
Clone the splunk-firehose-nozzle app from GitHub.
git clone https://github.com/cloudfoundry-community/splunk-firehose-nozzle.git cd splunk-firehose-nozzle -
Log in to Cloud Foundry:
cf login -a https://api.<your cf system domain> -u <your Cloud Foundry id>If you have not installed the Cloud Foundry command line interface, see Command line interfaces for Cloud Foundry Enterprise Environment.
-
Modify the
nozzle_manifestfile.vi ci/nozzle_manifest.yml- API_ENDPOINT: Cloud Foundry API endpoint address.
- API_USER: Cloud Foundry user name.
- API_PASSWORD: Cloud Foundry user's password.
- SPLUNK_TOKEN: For more information about this parameter, see Set up and use HTTP Event Collector
.
- SPLUNK_HOST: Splunk HTTP event collector host, such as
https://example.cloud.splunk.com:8088. - SPLUNK_INDEX: The Splunk index that events are sent to.
- FIREHOSE_SUBSCRIPTION_ID: Tags nozzle events with a Firehose subscription ID. For more information, see Loggregator Guide for Cloud Foundry Operators
. The Nozzle requires a user with the
doppler.firehosescope, and, if theADD_APP_INFOvalue istrue, thecloud_controller.admin_read_onlyscope. If thecloud_controller.admin_read_onlyscope is not available in the system, use thecloud_controller.adminvalue.
- Push the nozzle by running the following command:
make deploy-nozzle