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

Add fluentd configuration #26685

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@mofirouz

mofirouz commented Jun 13, 2018

We deploy CockroachDB on Google Cloud Platform and have a custom fluentd configuration setup so logs have the correct severity level, timestamp and more in Stackdriver Logging.

This PR contains the relevant parts of the fluentd configuration that is responsible for parsing the CockroachDB log output. This configmap does not depend on any cloud provider.

If you'd like, I can provide a GCP-specific configmap + daemonset to run fluentd.

@cockroach-teamcity

This comment has been minimized.

Show comment
Hide comment
@cockroach-teamcity

cockroach-teamcity Jun 13, 2018

Member

This change is Reviewable

Member

cockroach-teamcity commented Jun 13, 2018

This change is Reviewable

@a-robinson

Sorry for the delay on this, @mofirouz.

@@ -0,0 +1,82 @@
kind: ConfigMap

This comment has been minimized.

@a-robinson

a-robinson Jun 18, 2018

Member

Would you mind adding some comments to the top of the file explaining the purpose of this file and instructions for how to use it?

In particular, it seems worth calling out which parts are the main contributions of this file and referencing the source of the rest of it in case this falls out of date over time.

@a-robinson

a-robinson Jun 18, 2018

Member

Would you mind adding some comments to the top of the file explaining the purpose of this file and instructions for how to use it?

In particular, it seems worth calling out which parts are the main contributions of this file and referencing the source of the rest of it in case this falls out of date over time.

This comment has been minimized.

@mofirouz

mofirouz Oct 4, 2018

Sure - Most of it is actually written from scratch since the examples online are very specific and not general purpose :)

@mofirouz

mofirouz Oct 4, 2018

Sure - Most of it is actually written from scratch since the examples online are very specific and not general purpose :)

key_name log
</filter>
<filter reform.**>

This comment has been minimized.

@a-robinson

a-robinson Jun 18, 2018

Member

Can you explain this filter stanza for me? If it drops all logs that don't match the provided format, then what's the point of the <match reform.**> stanza below? And why does this stanza match on just reform.** while the next one matches more specifically on reform.var.log.containers.cockroachdb**?

More generally, a comment on each stanza explaining its purpose would be great for future maintainability.

@a-robinson

a-robinson Jun 18, 2018

Member

Can you explain this filter stanza for me? If it drops all logs that don't match the provided format, then what's the point of the <match reform.**> stanza below? And why does this stanza match on just reform.** while the next one matches more specifically on reform.var.log.containers.cockroachdb**?

More generally, a comment on each stanza explaining its purpose would be great for future maintainability.

This comment has been minimized.

@mofirouz

mofirouz Oct 4, 2018

The filters are not exclusively ran:

  • so the first <filter reform.**> is the default case matching on all log records. This is needed for all other containers running that are not CockroachDB.
  • the second <filter reform.**> runs on all log lines that match the regex inside of it. One can add extra patterns (say for custom applications there).

Each filter will republish the log record into fluentd queue so it can be picked up by other filters, hence why we change the tag name to parsed after we are done with it in the second filter.

Lastly, we make sure to only Match once on log records from the CockroachDB container so that we update the severity text from E to error etc (normalising the severity text format).

@mofirouz

mofirouz Oct 4, 2018

The filters are not exclusively ran:

  • so the first <filter reform.**> is the default case matching on all log records. This is needed for all other containers running that are not CockroachDB.
  • the second <filter reform.**> runs on all log lines that match the regex inside of it. One can add extra patterns (say for custom applications there).

Each filter will republish the log record into fluentd queue so it can be picked up by other filters, hence why we change the tag name to parsed after we are done with it in the second filter.

Lastly, we make sure to only Match once on log records from the CockroachDB container so that we update the severity text from E to error etc (normalising the severity text format).

@mofirouz

This comment has been minimized.

Show comment
Hide comment
@mofirouz

mofirouz Sep 10, 2018

Hi @a-robinson - apologies for the delay - this is still on my radar and will update the PR soon.

mofirouz commented Sep 10, 2018

Hi @a-robinson - apologies for the delay - this is still on my radar and will update the PR soon.

@a-robinson

This comment has been minimized.

Show comment
Hide comment
@a-robinson

a-robinson Oct 3, 2018

Member

Hi @mofirouz, any update on this?

Member

a-robinson commented Oct 3, 2018

Hi @mofirouz, any update on this?

@mofirouz

This comment has been minimized.

Show comment
Hide comment
@mofirouz

mofirouz Oct 4, 2018

@a-robinson I've added some general comments to this PR - let me know if you'd like more info.

P.s. (sorry closed by mistake)

mofirouz commented Oct 4, 2018

@a-robinson I've added some general comments to this PR - let me know if you'd like more info.

P.s. (sorry closed by mistake)

@mofirouz mofirouz closed this Oct 4, 2018

@mofirouz mofirouz reopened this Oct 4, 2018

@a-robinson

Thanks for the comments! This looks good other than the one question about fractional seconds.

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