Skip to content

Commit

Permalink
feat(logs): add daemonset and statefulset to default fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Świątek committed Jan 9, 2023
1 parent 6496419 commit 8ca6b80
Show file tree
Hide file tree
Showing 16 changed files with 213 additions and 27 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- feat: adjust average utilization for metadata autoscaling [#2744]
- chore: upgrade otelcol to 0.68.0-sumo-0 [#2755]
- chore: remove support for AKS 1.22 [#2756]
- feat(logs): add daemonset and statefulset to default fields [#2766]

### Fixed

Expand All @@ -29,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#2755]: https://github.com/SumoLogic/sumologic-kubernetes-collection/pull/2755
[#2756]: https://github.com/SumoLogic/sumologic-kubernetes-collection/pull/2756
[#2761]: https://github.com/SumoLogic/sumologic-kubernetes-collection/pull/2761
[#2766]: https://github.com/SumoLogic/sumologic-kubernetes-collection/pull/123
[v1.15.3-sumo-0]: https://github.com/SumoLogic/sumologic-kubernetes-fluentd/releases/tag/v1.15.3-sumo-0
[Unreleased]: https://github.com/SumoLogic/sumologic-kubernetes-collection/compare/v3.0.0-beta.0...main

Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/sumologic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The following table lists the configurable parameters of the Sumo Logic chart an
| `sumologic.logs.defaultFluentd.excludeHostRegex` | Configuration option only for Fluentd, a regular expression for hosts. Matching hosts will be excluded from Sumo. The logs will still be sent to FluentD. | `""` |
| `sumologic.logs.defaultFluentd.excludePriorityRegex` | Configuration option only for Fluentd, a regular expression for priority. Matching priority will be excluded from Sumo. The logs will still be sent to FluentD. | `""` |
| `sumologic.logs.defaultFluentd.excludeUnitRegex` | Configuration option only for Fluentd, a regular expression for unit. Matching unit will be excluded from Sumo. The logs will still be sent to FluentD. . | `""` |
| `sumologic.logs.fields` | Fields to be created at Sumo Logic to ensure logs are tagged with relevant metadata. [Sumo Logic help](https://help.sumologic.com/docs/manage/fields/#manage-fields) | `["cluster", "container", "deployment", "host", "namespace", "node", "pod", "service"]` |
| `sumologic.logs.fields` | Fields to be created at Sumo Logic to ensure logs are tagged with relevant metadata. [Sumo Logic help](https://help.sumologic.com/docs/manage/fields/#manage-fields) | `["cluster", "container", "daemonset", "deployment", "host", "namespace", "node", "pod", "service", "statefulset"]` |
| `sumologic.logs.metadata.provider` | Set provider to use for logs forwarding and metadata enrichment. Can be either otelcol or fluentd. | `otelcol` |
| `sumologic.metrics.enabled` | Set the enabled flag to false for disabling metrics ingestion altogether. | `true` |
| `sumologic.metrics.metadata.provider` | Set provider to use for metrics forwarding and metadata enrichment. Can be either otelcol or fluentd. | `otelcol` |
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/sumologic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,14 @@ sumologic:
fields:
- cluster
- container
- daemonset
- deployment
- host
- namespace
- node
- pod
- service
- statefulset

### Metrics configuration
## Set the enabled flag to false for disabling metrics ingestion altogether.
Expand Down
18 changes: 16 additions & 2 deletions tests/helm/terraform/static/all_fields.output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "daemonset" {
count = var.create_fields ? 1 : 0
field_name = "daemonset"
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "deployment" {
count = var.create_fields ? 1 : 0
Expand Down Expand Up @@ -258,6 +265,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "statefulset" {
count = var.create_fields ? 1 : 0
field_name = "statefulset"
data_type = "String"
state = "Enabled"
}
locals.tf: |
locals {
default_events_source = "events"
Expand Down Expand Up @@ -584,7 +598,7 @@ data:
local REMAINING
REMAINING=$(jq -e '.remaining' <<< "${RESPONSE}")
readonly REMAINING
if [[ $(( REMAINING - 8 )) -ge 10 ]] ; then
if [[ $(( REMAINING - 10 )) -ge 10 ]] ; then
return 0
else
return 1
Expand All @@ -606,7 +620,7 @@ data:
"${SUMOLOGIC_BASE_URL}"v1/fields | jq '.data[]' )"
readonly FIELDS_RESPONSE
declare -ra FIELDS=("cluster" "container" "deployment" "host" "namespace" "node" "pod" "service")
declare -ra FIELDS=("cluster" "container" "daemonset" "deployment" "host" "namespace" "node" "pod" "service" "statefulset")
for FIELD in "${FIELDS[@]}" ; do
FIELD_ID=$( echo "${FIELDS_RESPONSE}" | jq -r "select(.fieldName == \"${FIELD}\") | .fieldId" )
# Don't try to import non existing fields
Expand Down
18 changes: 16 additions & 2 deletions tests/helm/terraform/static/collector_fields.output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "daemonset" {
count = var.create_fields ? 1 : 0
field_name = "daemonset"
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "deployment" {
count = var.create_fields ? 1 : 0
Expand Down Expand Up @@ -258,6 +265,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "statefulset" {
count = var.create_fields ? 1 : 0
field_name = "statefulset"
data_type = "String"
state = "Enabled"
}
locals.tf: |
locals {
default_events_source = "events"
Expand Down Expand Up @@ -539,7 +553,7 @@ data:
local REMAINING
REMAINING=$(jq -e '.remaining' <<< "${RESPONSE}")
readonly REMAINING
if [[ $(( REMAINING - 8 )) -ge 10 ]] ; then
if [[ $(( REMAINING - 10 )) -ge 10 ]] ; then
return 0
else
return 1
Expand All @@ -561,7 +575,7 @@ data:
"${SUMOLOGIC_BASE_URL}"v1/fields | jq '.data[]' )"
readonly FIELDS_RESPONSE
declare -ra FIELDS=("cluster" "container" "deployment" "host" "namespace" "node" "pod" "service")
declare -ra FIELDS=("cluster" "container" "daemonset" "deployment" "host" "namespace" "node" "pod" "service" "statefulset")
for FIELD in "${FIELDS[@]}" ; do
FIELD_ID=$( echo "${FIELDS_RESPONSE}" | jq -r "select(.fieldName == \"${FIELD}\") | .fieldId" )
# Don't try to import non existing fields
Expand Down
18 changes: 16 additions & 2 deletions tests/helm/terraform/static/conditional_sources.output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "daemonset" {
count = var.create_fields ? 1 : 0
field_name = "daemonset"
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "deployment" {
count = var.create_fields ? 1 : 0
Expand Down Expand Up @@ -258,6 +265,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "statefulset" {
count = var.create_fields ? 1 : 0
field_name = "statefulset"
data_type = "String"
state = "Enabled"
}
locals.tf: |
locals {
}
Expand Down Expand Up @@ -459,7 +473,7 @@ data:
local REMAINING
REMAINING=$(jq -e '.remaining' <<< "${RESPONSE}")
readonly REMAINING
if [[ $(( REMAINING - 8 )) -ge 10 ]] ; then
if [[ $(( REMAINING - 10 )) -ge 10 ]] ; then
return 0
else
return 1
Expand All @@ -481,7 +495,7 @@ data:
"${SUMOLOGIC_BASE_URL}"v1/fields | jq '.data[]' )"
readonly FIELDS_RESPONSE
declare -ra FIELDS=("cluster" "container" "deployment" "host" "namespace" "node" "pod" "service")
declare -ra FIELDS=("cluster" "container" "daemonset" "deployment" "host" "namespace" "node" "pod" "service" "statefulset")
for FIELD in "${FIELDS[@]}" ; do
FIELD_ID=$( echo "${FIELDS_RESPONSE}" | jq -r "select(.fieldName == \"${FIELD}\") | .fieldId" )
# Don't try to import non existing fields
Expand Down
18 changes: 16 additions & 2 deletions tests/helm/terraform/static/custom.output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "daemonset" {
count = var.create_fields ? 1 : 0
field_name = "daemonset"
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "deployment" {
count = var.create_fields ? 1 : 0
Expand Down Expand Up @@ -258,6 +265,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "statefulset" {
count = var.create_fields ? 1 : 0
field_name = "statefulset"
data_type = "String"
state = "Enabled"
}
locals.tf: |
locals {
}
Expand Down Expand Up @@ -459,7 +473,7 @@ data:
local REMAINING
REMAINING=$(jq -e '.remaining' <<< "${RESPONSE}")
readonly REMAINING
if [[ $(( REMAINING - 8 )) -ge 10 ]] ; then
if [[ $(( REMAINING - 10 )) -ge 10 ]] ; then
return 0
else
return 1
Expand All @@ -481,7 +495,7 @@ data:
"${SUMOLOGIC_BASE_URL}"v1/fields | jq '.data[]' )"
readonly FIELDS_RESPONSE
declare -ra FIELDS=("cluster" "container" "deployment" "host" "namespace" "node" "pod" "service")
declare -ra FIELDS=("cluster" "container" "daemonset" "deployment" "host" "namespace" "node" "pod" "service" "statefulset")
for FIELD in "${FIELDS[@]}" ; do
FIELD_ID=$( echo "${FIELDS_RESPONSE}" | jq -r "select(.fieldName == \"${FIELD}\") | .fieldId" )
# Don't try to import non existing fields
Expand Down
18 changes: 16 additions & 2 deletions tests/helm/terraform/static/default.output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "daemonset" {
count = var.create_fields ? 1 : 0
field_name = "daemonset"
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "deployment" {
count = var.create_fields ? 1 : 0
Expand Down Expand Up @@ -258,6 +265,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "statefulset" {
count = var.create_fields ? 1 : 0
field_name = "statefulset"
data_type = "String"
state = "Enabled"
}
locals.tf: |
locals {
default_events_source = "events"
Expand Down Expand Up @@ -537,7 +551,7 @@ data:
local REMAINING
REMAINING=$(jq -e '.remaining' <<< "${RESPONSE}")
readonly REMAINING
if [[ $(( REMAINING - 8 )) -ge 10 ]] ; then
if [[ $(( REMAINING - 10 )) -ge 10 ]] ; then
return 0
else
return 1
Expand All @@ -559,7 +573,7 @@ data:
"${SUMOLOGIC_BASE_URL}"v1/fields | jq '.data[]' )"
readonly FIELDS_RESPONSE
declare -ra FIELDS=("cluster" "container" "deployment" "host" "namespace" "node" "pod" "service")
declare -ra FIELDS=("cluster" "container" "daemonset" "deployment" "host" "namespace" "node" "pod" "service" "statefulset")
for FIELD in "${FIELDS[@]}" ; do
FIELD_ID=$( echo "${FIELDS_RESPONSE}" | jq -r "select(.fieldName == \"${FIELD}\") | .fieldId" )
# Don't try to import non existing fields
Expand Down
18 changes: 16 additions & 2 deletions tests/helm/terraform/static/disable_default_metrics.output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "daemonset" {
count = var.create_fields ? 1 : 0
field_name = "daemonset"
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "deployment" {
count = var.create_fields ? 1 : 0
Expand Down Expand Up @@ -258,6 +265,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "statefulset" {
count = var.create_fields ? 1 : 0
field_name = "statefulset"
data_type = "String"
state = "Enabled"
}
locals.tf: |
locals {
default_events_source = "events"
Expand Down Expand Up @@ -530,7 +544,7 @@ data:
local REMAINING
REMAINING=$(jq -e '.remaining' <<< "${RESPONSE}")
readonly REMAINING
if [[ $(( REMAINING - 8 )) -ge 10 ]] ; then
if [[ $(( REMAINING - 10 )) -ge 10 ]] ; then
return 0
else
return 1
Expand All @@ -552,7 +566,7 @@ data:
"${SUMOLOGIC_BASE_URL}"v1/fields | jq '.data[]' )"
readonly FIELDS_RESPONSE
declare -ra FIELDS=("cluster" "container" "deployment" "host" "namespace" "node" "pod" "service")
declare -ra FIELDS=("cluster" "container" "daemonset" "deployment" "host" "namespace" "node" "pod" "service" "statefulset")
for FIELD in "${FIELDS[@]}" ; do
FIELD_ID=$( echo "${FIELDS_RESPONSE}" | jq -r "select(.fieldName == \"${FIELD}\") | .fieldId" )
# Don't try to import non existing fields
Expand Down
18 changes: 16 additions & 2 deletions tests/helm/terraform/static/disabled_dashboards.output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "daemonset" {
count = var.create_fields ? 1 : 0
field_name = "daemonset"
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "deployment" {
count = var.create_fields ? 1 : 0
Expand Down Expand Up @@ -258,6 +265,13 @@ data:
data_type = "String"
state = "Enabled"
}
resource "sumologic_field" "statefulset" {
count = var.create_fields ? 1 : 0
field_name = "statefulset"
data_type = "String"
state = "Enabled"
}
locals.tf: |
locals {
default_events_source = "events"
Expand Down Expand Up @@ -537,7 +551,7 @@ data:
local REMAINING
REMAINING=$(jq -e '.remaining' <<< "${RESPONSE}")
readonly REMAINING
if [[ $(( REMAINING - 8 )) -ge 10 ]] ; then
if [[ $(( REMAINING - 10 )) -ge 10 ]] ; then
return 0
else
return 1
Expand All @@ -559,7 +573,7 @@ data:
"${SUMOLOGIC_BASE_URL}"v1/fields | jq '.data[]' )"
readonly FIELDS_RESPONSE
declare -ra FIELDS=("cluster" "container" "deployment" "host" "namespace" "node" "pod" "service")
declare -ra FIELDS=("cluster" "container" "daemonset" "deployment" "host" "namespace" "node" "pod" "service" "statefulset")
for FIELD in "${FIELDS[@]}" ; do
FIELD_ID=$( echo "${FIELDS_RESPONSE}" | jq -r "select(.fieldName == \"${FIELD}\") | .fieldId" )
# Don't try to import non existing fields
Expand Down
Loading

0 comments on commit 8ca6b80

Please sign in to comment.