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

remove log_format, attach fields by default #232

Closed
wants to merge 9 commits into from

Conversation

samjsong
Copy link
Contributor

@samjsong samjsong commented Oct 11, 2019

Description

I recommend reviewing commit by commit (maybe also with "hide whitespace changes"), hopefully that makes it easier to read the changes

By removing the log_format config, the filter plugin now always attaches the metadata as _sumo_metadata.fields.

We did get rid of add_timestamp in the output plugin, so the logs that come in no longer have timestamp (but still have time). We'll have to explicitly decide what we want to do by default to make those config changes in the fluentd yaml.

TODO: use sumologic output plugin version 2.0.0 in DockerFile when gem is released, once SumoLogic/fluentd-output-sumologic#53 is merged

Testing performed
  • ci/build.sh
  • Redeploy fluentd and fluentd-events pods
  • Confirm events, logs, and metrics are coming in
  • Tested with locally built sumologic output plugin to verify behaviour

if annotations["sumologic.com/sourceHost"].nil?
sumo_metadata[:host] = sumo_metadata[:host] % k8s_metadata
else
sumo_metadata[:host] = annotations["sumologic.com/sourceHost"] % k8s_metadata
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does % mean here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question - for default source name, we use something like %{namespace}.%{pod}.%{container}, so if k8s_metadata contains keys for namespace, pod, or container, it will populate those values so we get a final source name like sumologic.fluentd-xxx.fluentd or something like that

I believe this was how we supported dynamically populating metadata values in our sumo metadata.

# message ${begin; record["message"].merge(JSON.parse(record["message"]["log"])).delete("log"); rescue JSON::ParserError; record["message"]; end}
# </record>
# </filter>
<match containers.**>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did we want to add before and after examples for each filter here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, will do that

@samjsong samjsong force-pushed the ssong-remove-log-format branch from 2617b69 to 30ee4c3 Compare October 16, 2019 22:05
@samjsong samjsong closed this Dec 3, 2019
@perk-sumo perk-sumo deleted the ssong-remove-log-format branch May 21, 2020 16:32
psaia pushed a commit to psaia/sumologic-kubernetes-collection that referenced this pull request May 25, 2021
* Add WAF collector

* Fmt

* Add role and S3 source

* Module role
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

Successfully merging this pull request may close these issues.

2 participants