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

Fluentd: concatenate long logs #68012

Merged
merged 3 commits into from
Oct 19, 2018
Merged

Conversation

desaintmartin
Copy link
Member

@desaintmartin desaintmartin commented Aug 29, 2018

What this PR does / why we need it:

  • Fluentd: concatenate long logs (>16KB) which have been splitted by Docker into several lines.
  • Add fluentd-plugin-concat to fluent Docker image.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #52444

Special notes for your reviewer:

  • This fix uses fluentd-plugin-concat, but maybe there are better solutions out there.
  • This fix does not use the "partial_message" feature in the upcoming Docker release

Release note:

Fluentd: concatenate long logs (>16KB) which have been splitted by Docker into several lines, using fluentd-plugin-concat plugin.

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 29, 2018
@neolit123
Copy link
Member

/sig instrumentation
/kind bug
/ok-to-test

@k8s-ci-robot k8s-ci-robot added sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. kind/bug Categorizes issue or PR as related to a bug. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 29, 2018
@desaintmartin
Copy link
Member Author

Up?
Using this in production for about a month. Although it might add some CPU usage for fluentd, it works well.

@desaintmartin
Copy link
Member Author

/retest

@desaintmartin
Copy link
Member Author

@neolit123 all test are passing, are you interested in reviewing?

@neolit123
Copy link
Member

@desaintmartin
LGTM, but it's up to sig-instrumentation to merge.
you can try pinging them in the slack channel (#sig-instrumentation) if this stalls on reviews.

@neolit123
Copy link
Member

might be a good idea to add a release note under Release note: as this is a bug fix.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Oct 11, 2018
@desaintmartin
Copy link
Member Author

Good suggestion, thanks.

@coffeepac
Copy link
Contributor

@desaintmartin thanks for your contribution! please up the patch level for the following versioned items:

  • fluentd-es-config (currently 0.1.5, should be 0.1.6)
    • need to up the patch level in fluentd-es-ds as well
  • fluentd-es-ds (currently 2.2.0, should move to 2.2.0)

@coffeepac
Copy link
Contributor

/assign @coffeepac

@desaintmartin
Copy link
Member Author

desaintmartin commented Oct 11, 2018

@coffeepac Thanks! isn't the versions in the fluentd-es-ds.yaml file tied to the used image which is still v2.2.0? Fixed for the configmap file.

@coffeepac
Copy link
Contributor

@desaintmartin often the same but not necessarily. the version for the daemonset spec is for the entire spec and any versioned resources in it. I expect them to align again when the image revs a minor version.

@coffeepac
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: coffeepac, desaintmartin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 11, 2018
@desaintmartin
Copy link
Member Author

/test pull-kubernetes-integration

@desaintmartin
Copy link
Member Author

@coffeepac Am I doing something wrong or is it OK that this test does not pass?

@coffeepac
Copy link
Contributor

that test is required to pass. I will take a quick look.

@desaintmartin
Copy link
Member Author

May I rebase from master to see if the test is passing?

@coffeepac
Copy link
Contributor

@desaintmartin sure. sorry, got a bit sidetracked from this.

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
…cker into several lines.

See kubernetes#52444.

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
@coffeepac
Copy link
Contributor

/test pull-kubernetes-e2e-gke

@desaintmartin
Copy link
Member Author

It finally passes.

@coffeepac
Copy link
Contributor

it takes a village.

@coffeepac
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 18, 2018
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

1 similar comment
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@coffeepac
Copy link
Contributor

/test pull-kubernetes-integration

@k8s-ci-robot k8s-ci-robot merged commit 12f726c into kubernetes:master Oct 19, 2018
@desaintmartin
Copy link
Member Author

Thanks. Should someone generate a new version of gcr.io/google-containers/fluentd-elasticsearch ?

@coffeepac
Copy link
Contributor

@desaintmartin yes.

I will submit a PR and go ping the appropriate person in the next few minutes.

@mmacfadden
Copy link

@desaintmartin Thanks for this, this has been kicking my butt! One question. I noticed that the concat filter was put in the output section right before going to elasticsearch. We are using the json parser like this for one of our containers that exports logs as JSON:

    # This configuration handles the filtering of the Convergence Server
    <filter **.some-kubernetes-tags>
      @type parser
      key_name log
      reserve_data false

      <parse>
        @type json
      </parse>
    </filter>

The parser has been failing because the JSON log message has been split by the 16k limitation that this PR is addressing. However, it seems like the rejoining of the logs is going to happen after this filter, which means this filter will likely still fail.

Am I correct in my assumption? Would there be a way to move the concat plugin up in the chain?

@desaintmartin
Copy link
Member Author

Can't you put this filter after the concatenation?
what I'm doing is

    # Concatenate multi-line logs (>=16KB)
    <filter kubernetes.var.log.containers.**> # yeah, small improvement since the PR
      @type concat
      key log
      multiline_end_regexp /\n$/
      separator ""
    </filter>

    <filter kubernetes.var.log.containers.**>
      @type parser
      key_name log
      <parse>
        @type multi_format
        <pattern>
          format json
        </pattern>
        <pattern>
          format nginx
        </pattern>
        <pattern>
          format none
        </pattern>
      </parse>
    </filter>

And it works well.

@mmacfadden
Copy link

@desaintmartin

Yes, I think that would work. That is what I was planning on doing. I just wanted to see if I was crazy in my assumption. Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Supporting docker log splitting in Kubernetes logging integrations
6 participants