Skip to content

[Enhancement] Add logdispatch.include-only-paths Allowlist Property #23

Description

@Mahesh-Langote

Description

The recently added logdispatch.exclude-paths property is useful for blocking specific paths such as /health and /actuator/**. However, in many real-world microservices only a specific set of paths should be monitored, and listing every other path to exclude becomes impractical at scale.

An allowlist property (include-only-paths) would be the more ergonomic and maintainable solution for these cases.

Problem Example

A service with 30+ endpoints where only the payment and order APIs need monitoring:

Without allowlist (impractical):

logdispatch:
  exclude-paths: "/health,/actuator/**,/metrics/**,/docs/**,/swagger-ui/**,/v3/api-docs/**,..."

With allowlist (clean and maintainable):

logdispatch:
  include-only-paths: "/api/v1/payments/**,/api/v1/orders/**"

Acceptance Criteria

  • Add a new property logdispatch.include-only-paths accepting a comma-separated list of URI patterns
  • Support Ant-style wildcards (e.g. /api/v1/**) using Spring's AntPathMatcher, consistent with exclude-paths
  • If include-only-paths is set and the request URI does not match any pattern, skip APM dispatch entirely
  • If include-only-paths is not set, behaviour falls back to the current default where all paths are monitored (non-breaking)
  • Define clear precedence when both exclude-paths and include-only-paths are configured:
    • Suggested rule: include-only-paths is evaluated first. If the path does not match, skip. If it matches, then evaluate exclude-paths.
  • Document both properties and their interaction clearly in the README

Proposed Configuration

logdispatch:
  server-url: "https://your-apm-server.com/api/v1/ingest/logs"
  api-key: "your-secret-api-key"
  include-only-paths: "/api/v1/payments/**,/api/v1/orders/**"
  exclude-paths: "/api/v1/payments/ping"

Notes

  • This is the natural complement to exclude-paths and completes the path filtering feature set
  • Follows the same allowlist vs denylist pattern used in Spring Security's requestMatchers
  • Non-breaking — users with no include-only-paths configured see zero behaviour change

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions