Automate Document Signing using the DocuSign API
Adam Yue
Jan. 27, 2020
/
Some companies use Splunk as the logging platform to
store and to aggregate the logs for all their environments.
This post explains how to integrate Splunk with Kubernetes using the Splunk-connect-for-kubernetes helm
charts.
Splunk-connect-for-kubernetes contains 3 components:
Component | Usage |
---|---|
logging | To collect container logs. |
metric | To collect metrics, such as cpu/memory usage. |
objects | To collect kubernetes resource status by calling the Kubernetes API. |
Create new app “kubernetes” or using exist app
Note: The app must be ‘visible’ to be able to add indexes to it.
Create following indexes for the default indexes of http event collector
index name | type | app |
---|---|---|
k8s_<ENV>_logging | Events | kubernetes |
k8s_<ENV>_metrics | Metrics | kubernetes |
k8s_<ENV>_objects | Events | kubernetes |
Note:
Step 1. Copy app folder in splunk master instance
For app: “kubernetes”, copy that app folder from /opt/splunk/etc/apps to /opt/splunk/etc/master-apps/
Step 2. On Splunk UI,
Step 3. Check the splunk data
Check that any indexer replication issue has resolved and that Splunk is showing green. This will cause the Indexer servers to restart on initial push
Navigate to Settings > Data Inputs > HTTP Event Collector
Notice: Do NOT enable indexer acknowledgement when creating following tokens
We need to create 3 HEC token for logging, metrics and object
HEC Token name | App Context | Select Allowed Indexes | Default index |
---|---|---|---|
k8s-<ENV>-logging | kubernetes | k8s_<ENV>_logging | k8s_<ENV>_logging |
k8s-<ENV>-metrics | kubernetes | k8s_<ENV>_metrics | k8s_<ENV>_metrics |
k8s-<ENV>-objects | kubernetes | k8s_<ENV>_objects | k8s_<ENV>_objects |
Download the latest Helm package from Splunk-connect-for-kubernetes.
The minimal value example:
splunk:
hec:
host: < splunk_host >
port: 8088
token: < splunk_hec_logging_token >
indexName: < splunk_logging_indexname >
Optional: Customize buffer setting
buffer:
"@type": memory
total_limit_size: 2000m
chunk_limit_size: 500m
chunk_limit_records: 100000
flush_at_shutdown: true
flush_interval: 5s
flush_thread_count: 10
overflow_action: block
retry_max_times: 3
retry_wait: 60
Optional: Customize filter setting
customFilters:
SetNamespaceFilter:
tag: "**"
type: grep
body: |
<exclude>
key namespace
pattern /(kube-system)/
</exclude>
<exclude>
key sourcetype
pattern /(fluentd:monitor-agent|kube:container:calico-node)/
</exclude>
You can deploy to kubernetes cluster via helm
directly.
Or generate kubernetes yaml files via helm template command and then deploy via kubectl.
helm template --name-template=k8s --namespace splunk-connect --output-dir ${output_folder} splunk-kubernetes-logging/
kubectl apply -f ${output_folder}/splunk-kubernetes-logging/templates/
index="k8s_<ENV>_logging"
Download the latest Helm package from Splunk-connect-for-kubernetes.
The minimal value example:
splunk:
hec:
host: < splunk_host >
port: 8088
token: < splunk_hec_metrics_token >
indexName: < splunk_metrics_indexname >
Optional: Customize filter setting
Please refer metrics-information for all supported metrics
It is recommended to customize the fluentd setting to collect minimal metrics that are required for monitoring.
customFilters:
SetContainerFilter:
tag: kube.container.**
type: grep
body: |
<regexp>
key metric_name
pattern /(cpu.usage_rate|cpu.limit|memory.usage|memory.limit)/
</regexp>
SetPodFilter:
tag: kube.pod.**
type: grep
body: |
<regexp>
key metric_name
pattern /(network.rx_bytes|network.tx_bytes|network.rx_errors|network.tx_errors|cpu.load.average.10s|cpu.usage_rate|cpu.limit|memory.usage|memory.limit|memory.available_bytes|volume.available_bytes|volume.used_bytes)/
</regexp>
SetNamespaceFilter:
tag: kube.namespace.**
type: grep
body: |
<regexp>
key metric_name
pattern /(usage|limit)/
</regexp>
SetNodeFilter:
tag: kube.node.**
type: grep
body: |
<regexp>
key metric_name
pattern /(network.rx_bytes|network.tx_bytes|network.rx_errors|network.tx_errors|cpu.usage_rate|memory.usage|memory.capacity|memory.available_bytes)/
</regexp>
You can deploy to kubernetes cluster via helm
directly.
Or generate kubernetes yaml files via helm template command and then deploy via kubectl.
helm template --name-template=k8s --namespace splunk-connect --output-dir ${output_folder} splunk-kubernetes-metrics/
kubectl apply -f ${output_folder}/splunk-kubernetes-metrics/templates/
Following splunk search can be used to check the supported dimensions of a metric:
| mcatalog values(_dims) WHERE index="*_metrics" AND metric_name="kube.pod.cpu.load.average.10s"
Splunk collects the resource information by calling the Kubernetes API. It help user/operator to set up splunk alerts when pod is in Error status.
Download the latest Helm package from Splunk-connect-for-kubernetes.
The minimal value example:
splunk:
hec:
host: < splunk_host >
port: 8088
token: < splunk_hec_objects_token >
indexName: < splunk_objects_indexname >
You can deploy to kubernetes cluster via helm
directly.
Or generate kubernetes yaml files via helm template command and then deploy via kubectl.
helm template --name-template=k8s --namespace splunk-connect --output-dir ${output_folder} splunk-kubernetes-objects/
kubectl apply -f ${output_folder}/splunk-kubernetes-objects/templates/
Query the number of running pods in splunk-connect namespace
index="k8s_<ENV>_objects" metadata.namespace="splunk-connect" status.phase="Running" | stats distinct_count(metadata.uid)
Address
Level 8
11-17 York Street
Sydney NSW 2000
Phone Number
+61 2 8294 8067
Email
[email protected]
By Adam Yue
By Felix Schmitz
© 2017-2024 Darumatic Pty Ltd. All Rights Reserved.