logagent-filter-output-sql
Version:
Filter and aggregate parsed logs with SQL
27 lines (24 loc) • 669 B
YAML
input:
files:
- './access.log'
outputFilter:
- module: logagent-filter-output-sql
config:
source: !!js/regexp /access.log|httpd/
interval: 1
queries:
- # calculate average page size for different HTTP methods
SELECT 'apache_stats' AS _type,
AVG(size) AS size_avg,
COUNT(method) AS method_count,
method as http_method
FROM ?
GROUP BY method
- # log each request to the login page
SELECT *
FROM ?
WHERE path like "/wp-login%"
output:
elasticsearch:
url: http://localhost:9200
index: mylogs