From 2181c28143f5329167fdb981ab5e20eacae91de8 Mon Sep 17 00:00:00 2001 From: Nelson Wang Date: Mon, 17 Jun 2019 17:06:06 -0700 Subject: [PATCH] Adding docs on UF sidecar model --- docs/EXAMPLES.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md index 4414df3e..7cfb47ad 100644 --- a/docs/EXAMPLES.md +++ b/docs/EXAMPLES.md @@ -20,6 +20,7 @@ Note that for more complex scenarios, we will opt to use a [Docker compose file] * [Create search head cluster](#create-search-head-cluster) * [Create indexer cluster and search head cluster](#create-indexer-cluster-and-search-head-cluster) * [Enable root endpoint on SplunkWeb](#enable-root-endpoint-on-splunkweb) +* [Create sidecar forwarder](#create-sidecar-forwarder) * [More](#more) ## Create standalone from CLI @@ -808,5 +809,47 @@ $ SPLUNK_PASSWORD= docker-compose up -d Then, visit SplunkWeb on your browser with the root endpoint in the URL, such as `http://localhost:8000/splunkweb`. +## Create sidecar forwarder +
k8s-sidecar.yml

+ +``` +apiVersion: v1 +kind: Pod +metadata: + name: example +spec: + containers: + - name: splunk-uf + image: splunk/universalforwarder:latest + env: + - name: SPLUNK_START_ARGS + value: --accept-license + - name: SPLUNK_PASSWORD + value: helloworld + - name: SPLUNK_CMD + value: add monitor /var/log/ + - name: SPLUNK_STANDALONE_URL + value: splunk.company.internal + volumeMounts: + - name: shared-data + mountPath: /var/log + - name: my-app + image: my-app + volumeMounts: + - name: shared-data + mountPath: /app/logs/ + volumes: + - name: shared-data + emptyDir: {} +``` +

+ +Execute the following to bring up your deployment: +``` +$ kubectl apply -f k8s-sidecar.yml +``` + +After your pod is ready, the universal forwarder will be reading the logs generated by your app via the shared volume mount. In the ideal case, your app is generating the logs while the forwarder is reading them and streaming the output to a separate Splunk instance located at splunk.company.internal. + ## More There are a variety of Docker compose scenarios in the `docker-splunk` repo [here](https://github.com/splunk/docker-splunk/tree/develop/test_scenarios). Please feel free to use any of those for reference in terms of different topologies!