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

feat(accesslogs): allow filter accesslogs by service names whitelist #10488

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ttys3
Copy link

@ttys3 ttys3 commented Mar 1, 2024

What does this PR do?

Enhancements

allow filter accesslogs by service names whitelist

like this:

# Configuring Multiple Filters
accessLog:
  filePath: "/path/to/access.log"
  format: json
  filters:
    serviceNames:
      - "service1@file"
      - "service2@consulcatalog"
      - "service3@consulcatalog"

Motivation

we have traefik which proxy api requests to all kinds of service, its a very heavy server, we do not want traefik write all the logs, only a few kind of important service we want access logs.

currently there's no way to filter like this in traefik.

More

  • Added/updated tests
  • Added/updated documentation

Additional Notes

@traefiker traefiker added this to the 3.0 milestone Mar 1, 2024
@jspdown jspdown self-assigned this Mar 4, 2024
@kevinpollet kevinpollet removed this from the 3.0 milestone Apr 4, 2024
@jspdown jspdown removed their assignment May 16, 2024
@rtribotte rtribotte self-assigned this May 23, 2024
@rtribotte
Copy link
Member

rtribotte commented May 23, 2024

Hello @ttys3,

Thanks for this contribution!

As this would be an enhancement, the changes should target the master branch for the next v3 minor version. Could you please rebase it?

Should the filtering of access logs be configurable statically, at least only, since services are dynamic resources?
We are unsure if this is the best approach, WDYT?

@ttys3 ttys3 force-pushed the feat/accesslogs_filter_by_service_names branch from ef1a40d to 29b7dba Compare May 24, 2024 15:30
@ttys3 ttys3 changed the base branch from v3.0 to master May 24, 2024 15:30
@ttys3
Copy link
Author

ttys3 commented May 24, 2024

Hello @ttys3,

Thanks for this contribution!

As this would be an enhancement, the changes should target the master branch for the next v3 minor version. Could you please rebase it?

Should the filtering of access logs be configurable statically, at least only, since services are dynamic resources? We are unsure if this is the best approach, WDYT?

rebased and change target to master

Yes, I agree that static array filters would be a little not extenable.

I'd glad to change it from ServiceNames []string to something like ServiceNamePatterns []string

so people could use regex to match service names, but compared to static array filters, this will need a little more cpu.

do you think it is better to change it to regex ?

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

Successfully merging this pull request may close these issues.

None yet

5 participants