pac-config-logging ConfigMap.
Logging ConfigMap
The logging configuration is stored in thepac-config-logging ConfigMap in the Pipelines as Code namespace (typically pipelines-as-code).
Viewing Logging Configuration
Configuration Structure
The ConfigMap contains two types of configuration:- Global Zap Logger Configuration - Defines output format, encoding, and default log level
- Component-Specific Log Levels - Overrides the default level for individual components
Example Configuration
Component Log Levels
Pipelines as Code has three main components, each with configurable log levels:Log level for the main
pipelines-as-code-controller component. This handles webhook events, repository management, and PipelineRun creation.Log level for the
pipelines-as-code-watcher component. This monitors PipelineRun status and reports results back to Git providers.Log level for the
pipelines-as-code-webhook component. This validates and mutates Pipelines as Code resources.Supported Log Levels
The Zap logger supports the following log levels (from most to least verbose):Fine-grained debugging information. Use for troubleshooting specific issues. Includes API call details, request/response data, and internal state.
Normal operational logging. Recommended for production. Logs important events like PipelineRun creation, status updates, and configuration changes.
Unexpected but non-critical errors. Indicates potential issues that don’t prevent operation.
Critical errors that are unexpected during normal operation. May indicate configuration issues or failures.
Triggers a panic (crash) in development mode. Logs critical errors that should never occur.
Triggers a panic (crash) in all modes. Use for unrecoverable errors.
Immediately exits the process with status 1. Use only for initialization failures.
Changing Log Levels
Update a Specific Component
Change the log level for a single component usingkubectl patch:
The watcher automatically picks up ConfigMap changes. Most components do not require restart for log level changes to take effect.
Use Same Level for All Components
To use a single log level for all components, remove the individualloglevel.* keys. Components will then use the level defined in zap-logger-config:
Debugging API Interactions
When troubleshooting Git provider integration issues (GitHub, GitLab, Bitbucket), enable debug logging for the controller to see detailed API interaction logs.Enable Debug Logging
API Call Logging
With debug logging enabled, the controller logs:- Request URL and method
- Response status code
- Request duration in milliseconds
- API rate limit information (for GitHub)
- Response payload (when relevant)
GitHub Rate Limit Monitoring
When debug logging is enabled for the controller, Pipelines as Code automatically monitors GitHub API rate limits and provides intelligent warnings.Rate Limit Thresholds
All API calls log duration, URL, and remaining rate limit count.
When remaining calls drop below 500, logs include additional context like total limit and reset time.
When remaining calls drop below 100, warnings alert administrators to potential quota issues.
When remaining calls drop below 50, critical alerts indicate immediate attention is needed.
Example Rate Limit Logs
Rate Limit Information
Rate limit logs include:- Remaining calls: Number of API calls left in current window
- Total limit: Maximum allowed calls (typically 5000 for authenticated requests)
- Reset time: Unix timestamp and human-readable time when limit resets
- Repository context: Which repository triggered the API call
Benefits of Rate Limit Monitoring
Rate limit monitoring helps you:
- Prevent service disruptions - Early warnings allow proactive measures
- Optimize API usage - Identify repositories consuming excessive API calls
- Plan maintenance - Schedule intensive operations around reset times
- Debug authentication - Rate limit headers indicate token validity
Viewing Logs
Controller Logs
Watcher Logs
Webhook Logs
Log Format
By default, logs are output in JSON format, which is ideal for log aggregation systems like Elasticsearch, Splunk, or Loki.JSON Log Structure
Changing Log Format
To output logs in console format (useful for local development):"encoding": "json" to "encoding": "console" in the zap-logger-config.
Troubleshooting Common Issues
Logs Not Updating After ConfigMap Change
Some components may need restart:Too Many Debug Logs
If debug logging produces too much output, enable it only for specific components:Finding Errors in Logs
Best Practices
Production Logging:
- Use
infolevel for production environments - Enable
debugtemporarily for troubleshooting - Use structured logging for easier parsing
- Integrate with log aggregation systems
- Set up alerts for
errorandwarnlevels
See Also
- Knative Logging Documentation - Detailed Zap logger configuration
- Metrics - Monitor Pipelines as Code with Prometheus
- Configuration - Main ConfigMap settings