Skip to content

Commit 356a399

Browse files
committed
json
1 parent a9083a1 commit 356a399

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

connect/connect-splunk-sink/splunk-sink.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ log "Splunk UI is accessible at http://127.0.0.1:8000 (admin/password)"
2020
# docker exec splunk bash -c 'sudo /opt/splunk/bin/splunk restart'
2121
# sleep 60
2222

23-
log "Create topic splunk-qs"
24-
docker exec broker kafka-topics --create --topic splunk-qs --partitions 10 --replication-factor 1 --bootstrap-server broker:9092
25-
23+
log "Sending messages to topic splunk-qs"
24+
playground topic produce -t splunk-qs --nb-messages 3 << 'EOF'
25+
{"store":{"book":[{"category":"reference", "sold": false,"author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","act": null, "isbn":"0-395-19395-8","price":22.99}],"bicycle":{"color":"red","price":19.95}}}
26+
EOF
2627

2728
log "Creating Splunk sink connector"
2829
playground connector create-or-update --connector splunk-sink << EOF
@@ -34,19 +35,15 @@ playground connector create-or-update --connector splunk-sink << EOF
3435
"splunk.hec.uri": "http://splunk:8088",
3536
"splunk.hec.token": "99582090-3ac3-4db1-9487-e17b17a05081",
3637
"splunk.sourcetypes": "my_sourcetype",
37-
"value.converter": "org.apache.kafka.connect.storage.StringConverter"
38+
"value.converter":"org.apache.kafka.connect.json.JsonConverter",
39+
"value.converter.schemas.enable":"false"
3840
}
3941
EOF
4042

41-
log "Sending messages to topic splunk-qs"
42-
playground topic produce -t splunk-qs --nb-messages 3 << 'EOF'
43-
This is a test with Splunk %g
44-
EOF
45-
4643
log "Sleeping 60 seconds"
4744
sleep 60
4845

4946
log "Verify data is in splunk"
5047
docker exec splunk bash -c 'sudo /opt/splunk/bin/splunk search "source=\"http:splunk_hec_token\"" -auth "admin:password"' > /tmp/result.log 2>&1
5148
cat /tmp/result.log
52-
grep "This is a test with Splunk" /tmp/result.log
49+
grep "Sword of Honour" /tmp/result.log

0 commit comments

Comments
 (0)