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 f3f8250
Show file tree
Hide file tree
Showing 15 changed files with 212 additions and 26 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 [#123]

### 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
[#123]: 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: 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
18 changes: 16 additions & 2 deletions tests/helm/terraform/static/disabled_monitors.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 f3f8250

Please sign in to comment.