- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5k
 
[k8s docs] include how to ingest rotated container log files, including GZIP compressed #47384
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
base: main
Are you sure you want to change the base?
Conversation
          🤖 GitHub commentsExpand to view the GitHub comments
 Just comment with: 
  | 
    
| 
           This pull request does not have a backport label. 
 To fixup this pull request, you need to add the backport labels for the needed 
  | 
    
          🔍 Preview links for changed docs | 
    
77a0a87    to
    51bb746      
    Compare
  
    51bb746    to
    ecd9e81      
    Compare
  
    ecd9e81    to
    c085ab8      
    Compare
  
    c085ab8    to
    839704f      
    Compare
  
    Update the existing docs and configuration examples to explain how to ingest Kubernetes rotated logs, including GZIP-compressed logs.
839704f    to
    7042e97      
    Compare
  
    | 
           Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)  | 
    
| 
           Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)  | 
    
Proposed commit message
Checklist
[ ] My code follows the style guidelines of this project[ ] I have commented my code, particularly in hard-to-understand areas[ ] I have added tests that prove my fix is effective or that my feature works. Where relevant, I have used thestresstest.shscript to run them under stress conditions and race detector to verify their stability../changelog/fragmentsusing the changelog tool.Disruptive User Impact
When enabling the ingestion of rotated logs on an existing deployment, it cause a one-time re-ingestion of the logs.
Author's Checklist
How to test this PR locally
Objective
To verify the correctness of Filebeat configurations for ingesting rotated Kubernetes logs, including gzip-compressed files. This guide tests two primary collection methods: static inputs (without autodiscover) and dynamic inputs (with autodiscover).
Background
Filebeat supports two main methods for collecting Kubernetes logs. A key difference between them involves metadata enrichment, specifically a limitation of the add_kubernetes_metadata processor, which is required when not using autodiscover.
This processor's logs_path matcher infers metadata by parsing the log file's path. The level of detail available depends entirely on the path structure:
Therefore, when using static inputs, only logs from /var/log/containers/ will receive full container-level metadata.
The autodiscover method does not have this limitation and adds container-level metadata to all logs, including rotated ones.
Prerequisites
kind create clusterflogper log path:docker exec -it kind-control-plane bashwc -l /var/log/pods/default*/*/0.logYou might need to adjust the
-dparameter if your machine is significantly faster or slower.Test Case 1: Static Inputs (Without Autodiscover)
Fresh Deployment
This test validates log ingestion on a new Filebeat deployment configured to read both active and rotated logs from the start.
flog.yaml:
filebeat-kubernetes.yaml:
kubernetes.pod.namebut will not containkubernetes.container.name(this is expected behaviour).Updating an Existing Deployment
This test validates that a Filebeat instance will correctly ingest rotated logs after being updated.
filebeat-kubernetes.yaml:
filebeat-kubernetes.yaml:
Test Case 2: Autodiscover
This test validates log ingestion using hints-based autodiscover.
flog.yaml:
filebeat-kubernetes-ConfigMap.yaml:
kubernetes.pod.nameandkubernetes.container.name. This confirms autodiscover is enriching all paths correctly.Related issues
Use cases
Ingest Kubernetes rotated logs