Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Add promtail configuration for `auth.log` [#27](https://github.com/coopdevs/monitoring-role/issues/27)

## [v0.5.0] - 2023-05-18
## Feat
- Add new exporter for users [#26](https://github.com/coopdevs/monitoring-role/pull/26/)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Uses docker to install Prometheus and Loki exporters:
This role supports some applications with their default logging format:
* [Odoo12](https://github.com/coopdevs/odoo-role)
* [Coopdevs backups](https://github.com/coopdevs/backups-role/)
* [`auth.log`](templates/promtail-config-apps/auth.j2)

Besides, it supports a [custom exporter](https://github.com/stfsy/prometheus-what-active-users-exporter) that exposes the active users in the system.

Expand Down
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ monitoring_promtail_image_version: latest
monitoring_promtail_modules_enabled:
- "backups"
- "odoo"
- "auth"
monitoring_promtail_modules_available:
backups:
# Use backups-role var if available.
Expand All @@ -34,6 +35,10 @@ monitoring_promtail_modules_available:
log_path: "{{ odoo_role_odoo_log_path | default('/var/log/odoo') }}/odoo.log"
template: "odoo-role.j2"
log_path_folder: "{{ odoo_role_odoo_log_path | default('/var/log/odoo') }}"
auth:
log_path: "/var/log/auth.log"
template: "auth.j2"
log_path_folder: "/var/log"

monitoring_promtail_config_dir: "/etc/promtail"
monitoring_promtail_config_filename: "config.yml"
Expand Down
20 changes: 20 additions & 0 deletions templates/promtail-config-apps/auth.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- job_name: auth
pipeline_stages:
- regex:
expression: '^(?P<timestamp>\S+ \S+ \S+) (?P<host>\S+) (?P<program>[^\[]+)(\[(?P<processid>\d+)\])?: (?P<message>.*)'

- timestamp:
source: timestamp
format: 'Jan 2 15:04:05'
location: 'Europe/Madrid'
- labels:
program:
- output:
source: message
static_configs:
- targets:
- localhost
labels:
job: auth
instance: {{ inventory_hostname }}
__path__: {{ monitoring_promtail_modules_available["auth"]["log_path"] }}