Skip to main content
Log filter policies control which logs pass through Edge. Use them to drop noise and sample high-volume events.

Basic Structure

Every log policy has:
  • match: One or more matchers that identify target logs
  • keep: What to do with matching logs

Matchers

Matchers identify which logs a policy applies to. When a policy has multiple matchers, all must match (AND logic).

Log Fields

Match on well-known log fields:

Log Attributes

Match on log record attributes:

Resource Attributes

Match on resource attributes (service name, host, etc.):

Scope Attributes

Match on instrumentation scope:

Match Types

Exact Match

Match the exact string value:

Regex Match

Match using RE2 regular expressions:
Common patterns:
  • ^prefix - Starts with
  • suffix$ - Ends with
  • word1.*word2 - Contains both words in order
  • (option1|option2) - Either option
  • \\d+ - One or more digits

Exists Match

Match on field presence:
Use exists: false to match when a field is absent.

Negation

Invert any match with negate:
This matches all logs except ERROR.

Keep Values

The keep field determines what happens to matching logs.

Drop All

Drop all matching logs. Use for:
  • Debug and trace logs in production
  • Health check logs
  • Known noisy log patterns

Keep All

Explicitly keep matching logs.

Percentage Sampling

Keep a random percentage of matching logs. Valid range: 0-100%. Use for:
  • High-volume events where you don’t need every instance
  • Cost reduction on repetitive logs

Rate Limiting

Keep up to N logs per time window:
  • 100/s - 100 per second
  • 1000/m - 1000 per minute
Use for:
  • Burst protection
  • Capping runaway log sources

Policy Precedence

When multiple policies match the same log, the most restrictive action wins:
  1. none (drop) beats everything
  2. Lower percentages beat higher percentages
  3. Rate limits are evaluated independently
Example: If Policy A says keep: 50% and Policy B says keep: none, the log is dropped.

Examples

Drop Debug Logs

Drop Health Checks

Sample by Service

Rate Limit Noisy Service

Drop by Attribute Presence

Combine Multiple Conditions

Keep Everything Except

Using negate to keep only important logs:

Best Practices

  1. Start broad, then narrow: Begin with service-level policies, then add event-specific ones
  2. Prefer exact matches: They are faster than regex
  3. Combine policies: Multiple simple policies are easier to manage than one complex policy
  4. Document intent: Use descriptive names and IDs
  5. Test first: Verify policies in a staging environment before production

Next Steps

Log Transform

Modify logs: redact, remove, rename, add

Metric Filter

Filter metrics