Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add source category prefix annotation #1501

Merged
merged 1 commit into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 43 additions & 3 deletions deploy/docs/Best_Practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [Filtering Prometheus Metrics by Namespace](#filtering-prometheus-metrics-by-namespace)
- [Modify the Log Level for Falco](#modify-the-log-level-for-falco)
- [Overriding metadata using annotations](#overriding-metadata-using-annotations)
- [Overriding source category with pod annotations](#overriding-source-category-with-pod-annotations)
- [Excluding data using annotations](#excluding-data-using-annotations)
- [Including subsets of excluded data](#including-subsets-of-excluded-data)
- [Templating Kubernetes metadata](#templating-kubernetes-metadata)
Expand Down Expand Up @@ -318,9 +319,12 @@ falco:
You can use [Kubernetes annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/)
to override some metadata and settings per pod.

- `sumologic.com/format` overrides log format (see `fluentd.logs.output.logFormat` for description)
- `sumologic.com/sourceCategory` overrides the `_sourceCategory` metadata
- `sumologic.com/sourceName` overrides the `_sourceName` metadata
- `sumologic.com/format` overrides the value of the `fluentd.logs.output.logFormat` property
- `sumologic.com/sourceCategory` overrides the value of the `fluentd.logs.containers.sourceCategory` property
- `sumologic.com/sourceCategoryPrefix` overrides the value of the `fluentd.logs.containers.sourceCategoryPrefix` property
- `sumologic.com/sourceCategoryReplaceDash` overrides the value of the `fluentd.logs.containers.sourceCategoryReplaceDash`
property
- `sumologic.com/sourceName` overrides the value of the `fluentd.logs.containers.sourceName` property

For example:

Expand Down Expand Up @@ -350,6 +354,42 @@ spec:
- containerPort: 80
```

### Overriding source category with pod annotations

The following example shows how to customize the source category for data from a specific deployment.
The resulting value of `_sourceCategory` field will be `my-component`:

```yaml
apiVersion: v1
kind: Deployment
metadata:
name: my-component-deployment
spec:
replicas: 1
selector:
app: my-component
template:
metadata:
annotations:
sumologic.com/sourceCategory: "my-component"
sumologic.com/sourceCategoryPrefix: ""
sumologic.com/sourceCategoryReplaceDash: "-"
labels:
app: my-component
name: my-component
spec:
containers:
- name: my-component
image: my-image
```

The `sumologic.com/sourceCategory` annotation defines the source category for the data.

The empty `sumologic.com/sourceCategoryPrefix` annotation removes the default prefix added to the source category.

The `sumologic.com/sourceCategoryReplaceDash` annotation with value `-` prevents the dash in the source category
from being replaced with another character.

### Excluding data using annotations

You can use the `sumologic.com/exclude` [annotation](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/)
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/sumologic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ sumologic:
fluentd:
image:
repository: public.ecr.aws/sumologic/kubernetes-fluentd
tag: 1.12.0-sumo-2
tag: 1.12.0-sumo-3
pullPolicy: IfNotPresent

## Specifies whether a PodSecurityPolicy should be created
Expand Down