-
Notifications
You must be signed in to change notification settings - Fork 135
docs: Add docs for tracking policy activity #2449
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ca4a5a5
docs: Add docs for tracking policy activity
tianfeng92 4308962
chore: nitpicking
tianfeng92 a0b9f25
chore: nitpicking
tianfeng92 a993a09
chore: remove configuration part since it is impossible for customer
tianfeng92 a4a1e6a
docs: add more query examples
tianfeng92 58b98c6
docs: add more detailed query samples
tianfeng92 ffdfe3e
chore: polish the sample query
tianfeng92 e4b1817
Update calico-enterprise/observability/elastic/policy-activity.mdx
tianfeng92 6b0e53a
Update calico-enterprise/observability/elastic/policy-activity.mdx
tianfeng92 cedf0c4
Update calico-enterprise/observability/elastic/policy-activity.mdx
tianfeng92 c1d4711
Update calico-enterprise/observability/elastic/policy-activity.mdx
tianfeng92 359ce91
Update calico-enterprise/observability/elastic/policy-activity.mdx
tianfeng92 4686146
Update calico-enterprise/observability/elastic/policy-activity.mdx
tianfeng92 006003d
docs: rewrite according to suggestions
tianfeng92 6a88102
docs: add limitations
tianfeng92 d17e2d9
chore: format note section
tianfeng92 289817a
chore: nit
tianfeng92 a24b0d8
chore: describe generation
tianfeng92 e50743a
Update calico-enterprise/observability/elastic/policy-activity.mdx
tianfeng92 46f9e42
fix: set max size of the returned log
tianfeng92 868a562
docs: add notes for query large size of data
tianfeng92 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
calico-enterprise/observability/elastic/policy-activity.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| --- | ||
| description: Learn how to use Policy Activity Logs to gain visibility into policy and rule activity. | ||
tianfeng92 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --- | ||
|
|
||
| # Policy Activity Logs | ||
tianfeng92 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| :::note | ||
|
|
||
| This feature is tech preview. Tech preview features may be subject to significant changes before they become GA. | ||
tianfeng92 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ::: | ||
|
|
||
| ## Big picture | ||
tianfeng92 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Policy Activity Logs provide granular visibility into network policy behavior within your cluster. | ||
|
|
||
| ## Value | ||
|
|
||
| Track exactly which rules are evaluated and triggered, offering policy-centric context that complements standard Flow Logs. | ||
|
|
||
| ## How it works | ||
|
|
||
| - **Collection**: The Calico Enterprise automatically monitors policy and rule evaluations across your cluster. | ||
tianfeng92 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - **Storage**: These events are securely forwarded and indexed in your Elasticsearch cluster for analysis. | ||
| - **Analysis**: You can query the logs to audit network policy and rules and validate policy enforcement history. | ||
|
|
||
| ## Accessing the data | ||
|
|
||
| You can access Policy Activity Logs by querying Elasticsearch directly or visualizing them in Kibana (if configured). | ||
|
|
||
| ### Log structure | ||
|
|
||
| Each log entry contains the following key fields: | ||
|
|
||
| | Field | Description | Example | | ||
| | ----------------- | -------------------------------------------------------------------------------------------- | -------------------------------- | | ||
| | `policy.kind` | The type of the policy (e.g., `NetworkPolicy`, `GlobalNetworkPolicy`). | `NetworkPolicy` | | ||
tianfeng92 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
tianfeng92 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | `policy.namespace`| The namespace where the policy is defined. | `my-test` | | ||
| | `policy.name` | The unique name of the policy. | `my-tier.my-networkpolicy` | | ||
| | `rule` | The identifier for the specific rule that was triggered, formatted as `{generation}-{direction}-{rule_index}`. | `2-ingress-4` | | ||
ctauchen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| | `cluster` | The name of the cluster where the activity occurred. | `cluster` | | ||
| | `last_evaluated` | The timestamp when the rule was last evaluated. | `2025-12-01T23:09:28.384714204Z` | | ||
|
|
||
| ### Sample query in Elasticsearch | ||
tianfeng92 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| To find policies unused for 90 days: | ||
tianfeng92 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
tianfeng92 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ``` | ||
| GET tigera_secure_ee_policy_activity*/_search | ||
| { | ||
| "query": { | ||
| "range": { | ||
| "last_evaluated": { | ||
| "lte": "now-90d" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.