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

[newrelic-logging] filter by namespace #315

Open
cazter opened this issue Apr 5, 2021 · 3 comments
Open

[newrelic-logging] filter by namespace #315

cazter opened this issue Apr 5, 2021 · 3 comments

Comments

@cazter
Copy link

cazter commented Apr 5, 2021

Trying to reduce our NR ingest volume, specifically the logs portion. While I see that there is support for removing pods using an annotation it would be much easier/cleaner if we could specify namespaces to enable or disable logging.

@paologallinaharbur paologallinaharbur changed the title filter by namespace [newrelic-logging] filter by namespace Apr 20, 2021
@jkalwar
Copy link

jkalwar commented May 18, 2021

+1. This is something we are also looking at.

@ghost
Copy link

ghost commented Sep 14, 2022

+1

@cazter
Copy link
Author

cazter commented Oct 5, 2022

Late update to this post but we filtered by making the following changes to the configmap:

Allowing regex, the below line excludes each of the defined namespaces; "pg*, monitoring and devops.

Exclude_Path      /var/log/containers/*_pg*_*.log, /var/log/containers/*_monitoring_*.log, /var/log/containers/*_devops_*.log
apiVersion: v1
data:
  filter-kubernetes.conf: |
    [FILTER]
        Name           record_modifier
        Match          *
        Record         cluster_name ${CLUSTER_NAME}

    [FILTER]
        Name           kubernetes
        Match          kube.*
        Kube_URL       https://kubernetes.default.svc:443
        K8S-Logging.Exclude ${K8S_LOGGING_EXCLUDE}
  fluent-bit.conf: |
    [SERVICE]
        Flush         1
        Log_Level     ${LOG_LEVEL}
        Daemon        off
        Parsers_File  parsers.conf
        HTTP_Server   On
        HTTP_Listen   0.0.0.0
        HTTP_Port     2020

    @INCLUDE input-kubernetes.conf
    @INCLUDE output-newrelic.conf
    @INCLUDE filter-kubernetes.conf
  input-kubernetes.conf: |
    [INPUT]
        Name              tail
        Tag               kube.*
        Path              ${PATH}
        Exclude_Path      /var/log/containers/*_pg*_*.log, /var/log/containers/*_monitoring_*.log, /var/log/containers/*_devops_*.log
        Parser            ${LOG_PARSER}
        DB                /var/log/flb_kube.db
        Mem_Buf_Limit     7MB
        Skip_Long_Lines   On
        Refresh_Interval  10
  output-newrelic.conf: |
    [OUTPUT]
        Name  newrelic
        Match *
        licenseKey ${LICENSE_KEY}
        endpoint ${ENDPOINT}
  parsers.conf: |
    # Relevant parsers retrieved from: https://github.com/fluent/fluent-bit/blob/master/conf/parsers.conf
    [PARSER]
        Name         docker
        Format       json
        Time_Key     time
        Time_Format  %Y-%m-%dT%H:%M:%S.%L
        Time_Keep    On

    [PARSER]
        Name cri
        Format regex
        Regex ^(?<time>[^ ]+) (?<stream>stdout|stderr) (?<logtag>[^ ]*) (?<message>.*)$
        Time_Key    time
        Time_Format %Y-%m-%dT%H:%M:%S.%L%z
kind: ConfigMap
metadata:
  annotations:
    meta.helm.sh/release-name: newrelic-logging
    meta.helm.sh/release-namespace: devops
  labels:
    app: newrelic-logging
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: newrelic-logging
    chart: newrelic-logging-1.4.4
    heritage: Helm
    release: newrelic-logging
  name: newrelic-logging-fluent-bit-config
  namespace: devops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants