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

how to limit loglevels/severity of forwarded logs: splunk is flooded with "info" ? #10

Open
toastbrotch opened this issue Mar 25, 2021 · 8 comments

Comments

@toastbrotch
Copy link

toastbrotch commented Mar 25, 2021

hi
i use your sample (https://github.com/sabre1041/openshift-logforwarding-splunk/blob/master/charts/openshift-logforwarding-splunk/values.yaml) on openshift 4.6 with "loglevel: warn", but on splunk i see
86% of messages is level "info"
13% "unknown"
0.5% "Metadata"
0.01% "warning"
0.003% "notice"
0.0000... "RequestResponse"
0.0000... "err"

so this option does not seem to work or it does not limit the forwarded messages, as i think. i forward audit, app and infro to splunk. i see 3million messages in 2hours, on fresh setup without any workload, which instantly exploded our splunk server & license.

how do i debug this?

@gmcbrien
Copy link

I seem to have the same issue - Splunk is getting 1.5m message / hour, including info. However, the fluent.conf file seems to be correctly configured, according to this

Extract from fluent.conf:

<system>
  log_level "#{ENV['LOG_LEVEL'] }"
</system>

Environment variable:

sh-4.4$ env | grep LEVEL
LOG_LEVEL=warn

Would anybody have an idea why I (and @toastbrotch) are seeing 'info' messages in Splunk?

@sabre1041
Copy link
Owner

@gmcbrien this configuration does not configure the level of logs that are sent to splunk. it ONLY sets the logging level for the fluentd forwarder itself and not any filtering of the data that it is processing

@gmcbrien
Copy link

Oops - thanks @sabre1041 makes sense.... Then, please consider my 'issue' closed :)

@toastbrotch
Copy link
Author

@toastbrotch toastbrotch changed the title loglevel limitation does not work: splunk is flooded how to limit loglevels/severity of forwarded logs: splunk is flooded with "info" ? Mar 31, 2021
@DanaEHI
Copy link

DanaEHI commented Mar 31, 2021

We have had the same issue - we had to disable this while we figure out how to filter logs. We have 5 clusters, sending about 45M logs a day with this enabled :(

@toastbrotch
Copy link
Author

toastbrotch commented Apr 8, 2021

my quickfix so far to get rid of "info", "unknown" and "notice":

#add filter to charts/openshift-logforwarding-splunk/templates/log-forwarding-splunk-configmap.yaml
...
    </source>

    <filter **>
      @type grep
      <exclude>
        key level
        pattern /info|unknown|notice/
      </exclude>
      <exclude>
        key message
        pattern /^level=info /
      </exclude>
    </filter>

    <match **>
...

@worsco
Copy link
Contributor

worsco commented Aug 12, 2021

my quickfix so far to get rid of "info", "unknown" and "notice":

#add filter to charts/openshift-logforwarding-splunk/templates/log-forwarding-splunk-configmap.yaml
...
    </source>

    <filter **>
      @type grep
      <exclude>
        key level
        pattern /info|unknown|notice/
      </exclude>
      <exclude>
        key message
        pattern /^level=info /
      </exclude>
    </filter>

    <match **>
...

@toastbrotch

Have you considered creating a PR and making this something that could be configured (enabled/disabled/tweaked) through the chart?

@toastbrotch
Copy link
Author

toastbrotch commented Aug 12, 2021

not yet. and i had to change it aswell, as my original solution deleted also the whole workload-logs as it was UNKNOWN!

this is my current solution i'm testing. therefore i added a label "customer: myworkload" to each of the namespaces (oc label namespace foo customer=myworkload --overwrite) i want to receive the workload logs and i filter it this rather hacky way:

    </source>

    <filter **>
      @type record_transformer
      enable_ruby true
      auto_typecast true
      <record>
        level ${!record["kubernetes"].nil? && !record["kubernetes"]["namespace_labels"].nil? && !record["kubernetes"]["namespace_labels"]["customer"].nil? && record["kubernetes"]["namespace_labels"]["customer"] == "myworkload" ? "warning" : "unknown"}
      </record>
    </filter>

    <filter **>
      @type grep
      <exclude>
        key level
        pattern /info|unknown|notice/
      </exclude>
      <exclude>
        key message
        pattern /^level=info /
      </exclude>
    </filter>

    <match **>

seems to work despite hacky

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

No branches or pull requests

5 participants