Skip to content

Commit 4cb0477

Browse files
author
Donald Tregonning
authored
Merge pull request #98 from cloudfoundry-community/feature/deploy-nozzle-as-PCF-app-via-tile
Feature/deploy nozzle as pcf app via tile
2 parents 0653657 + 416eb00 commit 4cb0477

File tree

5 files changed

+167
-1
lines changed

5 files changed

+167
-1
lines changed

events/events.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package events
22

33
import (
4+
"encoding/json"
45
"fmt"
56
"sort"
67
"strings"
@@ -235,13 +236,19 @@ func AuthorizedEvents() string {
235236
}
236237

237238
func ParseSelectedEvents(wantedEvents string) (map[string]bool, error) {
239+
wantedEvents = strings.TrimSpace(wantedEvents)
238240
selectedEvents := make(map[string]bool)
239241
if wantedEvents == "" {
240242
selectedEvents["LogMessage"] = true
241243
return selectedEvents, nil
242244
}
243245

244-
for _, event := range strings.Split(wantedEvents, ",") {
246+
var events []string
247+
if err := json.Unmarshal([]byte(wantedEvents), &events); err != nil {
248+
events = strings.Split(wantedEvents, ",")
249+
}
250+
251+
for _, event := range events {
245252
event = strings.TrimSpace(event)
246253
if IsAuthorizedEvent(event) {
247254
selectedEvents[event] = true

tile/build.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
if [ "$0" != "./build.sh" ]; then
6+
echo "build.sh should be run from within the tile directory"
7+
exit 1
8+
fi
9+
10+
echo "building go binary"
11+
pushd ..
12+
curdir=`pwd`
13+
go get github.com/cloudfoundry-community/splunk-firehose-nozzle
14+
cd $GOPATH/src/github.com/cloudfoundry-community/splunk-firehose-nozzle && git checkout develop && env GOOS=linux GOARCH=amd64 make build VERSION=1.0
15+
cp $GOPATH/src/github.com/cloudfoundry-community/splunk-firehose-nozzle/splunk-firehose-nozzle ${curdir}/../splunk-firehose-nozzle/
16+
cd ${curdir}
17+
popd
18+
19+
echo "building tile"
20+
tile build

tile/icon.png

5.38 KB
Loading

tile/tile-history.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
history:
3+
- 0.2.1
4+
version: 1.0.0

tile/tile.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
name: splunk-nozzle
3+
label: Splunk Firehose Nozzle for PCF
4+
description: Forward firehose logs & metrics to Splunk
5+
icon_file: icon.png
6+
7+
8+
org_quota: 4096 # Optional, memory quota in mb
9+
apply_open_security_group: true # Apply open security group, default: false
10+
allow_paid_service_plans: true # Allow paid service plans, default: false
11+
12+
stemcell_criteria:
13+
os: ubuntu-trusty
14+
requires_cpi: false
15+
version: '3421'
16+
17+
properties:
18+
- name: author
19+
type: string
20+
label: Author
21+
value: Shubham Jain
22+
23+
forms:
24+
- name: splunk-config
25+
label: Splunk Settings
26+
description: Splunk HTTP Event Collector Settings
27+
markdown: |
28+
Configure your Splunk HTTP Event Collector. See http://docs.splunk.com/Documentation/Splunk/latest/Data/UsetheHTTPEventCollector
29+
properties:
30+
- name: splunk_host
31+
type: string
32+
label: HTTP Event Collector Endpoint URL
33+
description: HTTP Event Collector endpoint URL.
34+
- name: splunk_token
35+
type: secret
36+
label: HTTP Event Collector Token
37+
description: Splunk HTTP Event Collector token.
38+
- name: skip_ssl_validation_splunk
39+
type: boolean
40+
label: Skip SSL Validation
41+
default: false
42+
description: Skip SSL certificate validation for connection to Splunk. Secure communications will not check SSL certificates against a trusted Certificate Authority.
43+
- name: splunk_index
44+
type: string
45+
label: Index
46+
description: The name of the Splunk index that events will be sent to. WARNING:Setting an invalid index will cause events to be lost.
47+
default: main
48+
49+
- name: cf-config
50+
label: Cloud Foundry Settings
51+
description: Cloud Foundry Connection Settings
52+
properties:
53+
- name: api_endpoint
54+
type: string
55+
label: API Endpoint
56+
description: Cloud Foundry API endpoint.
57+
- name: api_user
58+
type: string
59+
label: API User
60+
description: API username
61+
- name: api_password
62+
type: secret
63+
label: API Password
64+
description: Password for API user
65+
- name: skip_ssl_validation_cf
66+
type: boolean
67+
label: Skip SSL Validation
68+
default: false
69+
description: Skip SSL certificate validation for connection to Cloud Foundry. Secure communications will not check SSL certificates against a trusted Certificate Authority. Skipping SSL validation in production environment is not recommended.
70+
- name: events
71+
type: multi_select_options
72+
label: Event Types
73+
default: ['HttpStartStop', 'LogMessage', 'ValueMetric', 'CounterEvent', 'Error', 'ContainerMetric']
74+
options:
75+
- name: HttpStartStop
76+
label: HttpStartStop
77+
- name: LogMessage
78+
label: LogMessage
79+
- name: ValueMetric
80+
label: ValueMetric
81+
- name: CounterEvent
82+
label: CounterEvent
83+
- name: Error
84+
label: Error
85+
- name: ContainerMetric
86+
label: ContainerMetric
87+
description: Event types to forward to Splunk.
88+
89+
- name: advanced
90+
label: Advanced
91+
description: Additional Nozzle Configuration
92+
properties:
93+
- name: scale_out_nozzle
94+
type: integer
95+
label: Scale Out Nozzle
96+
description: Scale out Splunk nozzle. Recommendation:Run 2 or more nozzles for high availability.
97+
default: 2
98+
- name: firehose_subscription_id
99+
type: string
100+
label: Firehose Subscription ID
101+
description: Unique subscription ID to nozzle. Firehose balances across socket connections with the same ID.
102+
optional: true
103+
- name: extra_fields
104+
type: string
105+
label: Additional Fields
106+
description: A set of key:value pairs formatted as "key1:value1, key2:value2, key3:value3" that do not occur in the event payload. These fields are added to every event payload for indexing by Splunk and are used to tag all events.
107+
optional: true
108+
- name: add_app_info
109+
type: boolean
110+
default: false
111+
label: Add App Information
112+
description: Enriches raw data with application metadata, such as application name, space name, org name, etc.
113+
- name: enable_event_tracing
114+
type: boolean
115+
label: Enable Event Tracing
116+
default: false
117+
description: Enables data loss tracing.
118+
119+
120+
packages:
121+
- name: splunk-firehose-nozzle
122+
type: app
123+
label: Splunk-Firehose-Nozzle
124+
manifest:
125+
memory: 512M
126+
instances: MY_INSTANCE_COUNT
127+
buildpack: binary_buildpack
128+
health-check-type: process
129+
no-route: true
130+
path: ../splunk-firehose-nozzle
131+
command: ./splunk-firehose-nozzle
132+
env:
133+
GOPACKAGENAME: main
134+
pre_deploy: |
135+
sed -i "s/MY_INSTANCE_COUNT/$SCALE_OUT_NOZZLE/g" $PACKAGE_PATH/splunk_firehose_nozzle/manifest.yml

0 commit comments

Comments
 (0)