Monitoring¶
This page explains how to monitor the GeoServer ACL service and plugin to ensure optimal performance, troubleshoot issues, and maintain security.
Monitoring Overview¶
Monitoring GeoServer ACL involves tracking several aspects:
- System Health: Ensuring all components are operational
- Performance Metrics: Tracking response times and throughput
- Access Logs: Recording authorization decisions and rule evaluations
- Error Tracking: Identifying and diagnosing issues
- Security Events: Monitoring for suspicious activities
Built-in Monitoring Tools¶
GeoServer ACL includes built-in monitoring capabilities through Spring Boot Actuator. For enhanced security and separation of concerns, actuator endpoints are exposed on a dedicated management port (typically 8081) and do not inherit the /acl service context path.
Health Endpoints¶
The health endpoint provides information on system status:
Response example:
{
"status": "UP",
"components": {
"db": {
"status": "UP",
"details": {
"database": "PostgreSQL",
"validationQuery": "isValid()"
}
},
"diskSpace": {
"status": "UP",
"details": {
"total": 500107862016,
"free": 96612954112,
"threshold": 10485760
}
}
}
}
Metrics Endpoint¶
The metrics endpoint provides detailed performance metrics:
To view specific metrics:
Response example:
{
"name": "http.server.requests",
"measurements": [
{
"statistic": "COUNT",
"value": 2385
},
{
"statistic": "TOTAL_TIME",
"value": 133.607534
},
{
"statistic": "MAX",
"value": 0.631959
}
],
"availableTags": [
{
"tag": "uri",
"values": [
"/acl/api/rules",
"/acl/api/authorization",
"/acl/api/adminrules"
]
},
{
"tag": "status",
"values": [
"200",
"404",
"500"
]
}
]
}
Configuring Actuator¶
To enable additional actuator endpoints, configure application.yml:
management:
endpoints:
web:
exposure:
include: health,info,metrics,loggers,httptrace
endpoint:
health:
show-details: always
Logging Configuration¶
Proper logging is essential for monitoring and troubleshooting.
Log Levels¶
Configure log levels in application.yml:
logging:
level:
root: INFO
org.geoserver.acl: INFO
org.geoserver.acl.authorization: DEBUG
org.springframework: WARN
Common log levels: - ERROR: Only error events - WARN: Warning and error events - INFO: Informational events plus warnings and errors - DEBUG: Detailed information for debugging - TRACE: Most detailed information
Log Format¶
Configure the log format to include relevant information:
logging:
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
file: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
Log Files¶
Configure log file outputs:
Monitoring Performance¶
Performance Metrics¶
- Rule Evaluation Times: How long it takes to evaluate rules
- Database Query Performance: Response times for database operations
- API Response Times: Overall API endpoint performance
- Cache Hit Rates: Effectiveness of caching
- Memory Usage: JVM heap and non-heap memory
- Thread Pool Utilization: Thread usage and contention
Tracking Performance Metrics¶
Using Actuator metrics:
http://localhost:8081/actuator/metrics/acl.rule.evaluation
http://localhost:8081/actuator/metrics/http.server.requests
Performance Optimization¶
If monitoring reveals performance issues:
- Increase Cache Size: Configure larger caches for frequently accessed rules
- Optimize Database: Add indexes for common query patterns
- Tune JVM: Allocate appropriate memory and GC settings
- Optimize Rules: Reduce the number of rules or improve rule organization
- Horizontal Scaling: Deploy multiple instances behind a load balancer
Integration with External Monitoring Systems¶
Prometheus Integration¶
Spring Boot applications can expose Prometheus metrics:
management:
metrics:
export:
prometheus:
enabled: true
endpoints:
web:
exposure:
include: prometheus
Access Prometheus metrics at:
Grafana Dashboards¶
Create Grafana dashboards to visualize metrics from Prometheus:
- Add Prometheus as a data source in Grafana
- Import or create dashboards for:
- System health
- Request rates and latencies
- Error rates
- Memory usage
- Database connection pool
ELK Stack Integration¶
For log analysis:
- Configure Filebeat to collect logs
- Send logs to Logstash for processing
- Store in Elasticsearch
- Visualize with Kibana
Alerting¶
Set up alerts to notify administrators of potential issues:
Health Checks¶
Monitor the health endpoint and trigger alerts when status is not "UP":
Performance Alerts¶
Set thresholds for important metrics:
- Rule evaluation time > 100ms
- API response time > 500ms
- Error rate > 1%
- Memory usage > 80%
Log-based Alerts¶
Monitor logs for critical events:
- Authentication failures
- Authorization failures with unusual patterns
- Database connection issues
- Unexpected exceptions
Security Monitoring¶
Authentication Monitoring¶
Track authentication attempts:
- Failed login attempts
- Unusual login patterns
- Repeated authentication failures from the same source
Authorization Monitoring¶
Monitor authorization decisions:
- Track denied access patterns
- Look for unusual rule evaluation patterns
- Monitor rule changes
Admin Actions Monitoring¶
Track administrative actions:
- Rule additions, modifications, and deletions
- Admin rule changes
- Configuration changes
Audit Logging¶
Enable comprehensive audit logging for security and compliance:
Troubleshooting Common Issues¶
High Rule Evaluation Times¶
If rule evaluation is slow:
- Check Rule Count: Too many rules can slow down evaluation
- Review Rule Organization: Ensure high-priority rules match frequently
- Examine Database Performance: Slow database queries might be the cause
- Enable Query Logging: Add SQL logging to identify slow queries
Memory Issues¶
For memory-related problems:
- Check Heap Usage: Monitor JVM heap usage
- Optimize Cache Settings: Adjust cache sizes
- Enable GC Logging: Add detailed garbage collection logging
- Tune JVM Settings: Adjust memory allocation and GC parameters
Connection Pool Exhaustion¶
If database connections are being exhausted:
- Increase Pool Size: Configure a larger connection pool
- Check Connection Leaks: Ensure connections are being closed
- Reduce Connection Holding Time: Optimize query execution
- Add Connection Timeout: Set appropriate timeouts
Monitoring Best Practices¶
- Establish Baselines: Measure normal performance to detect anomalies
- Monitor Trends: Track metrics over time to identify gradual degradation
- Comprehensive Coverage: Monitor all components (service, database, plugin)
- Correlate Metrics: Connect performance metrics with user experience
- Regular Review: Periodically review monitoring data for improvements
- Test Alerting: Ensure alert mechanisms work as expected
- Document Procedures: Create runbooks for common issues