nextcloud: Scrape logs with Promtail

Nextcloud writes JSON-structured logs to
`/var/lib/nextcloud/data/nextcloud.log`.  These logs contain errors,
etc. from the Nextcloud server, which are useful for troubleshooting.
Having them in Loki will allow us to view them in Grafan as well as
generate alerts for certain events.
frigate-exporter
Dustin 2024-10-13 18:05:50 -05:00
parent ceaef3f816
commit 9bea8e1ce7
1 changed files with 31 additions and 0 deletions

View File

@ -21,3 +21,34 @@ restic_include:
restic_exclude: restic_exclude:
- /var/lib/nextcloud/data/*/files_trashbin - /var/lib/nextcloud/data/*/files_trashbin
- /var/lib/nextcloud/.snapshots - /var/lib/nextcloud/.snapshots
promtail_dac_read_search: true
promtail_scrape_configs:
- '{{ promtail_default_scrape.journal }}'
- job_name: nextcloud
static_configs:
- labels:
__path__: /var/lib/nextcloud/data/nextcloud.log*
job: nextcloud
pipeline_stages:
- json:
expressions:
timestamp: time
level: level
- timestamp:
source: timestamp
format: '2006-01-02T15:04:05-07:00'
- labels:
level:
- job_name: nextcloud-updater
static_configs:
- labels:
__path__: /var/lib/nextcloud/data/updater.log
job: nextcloud-updater
pipeline_stages:
- regex:
expression: >-
^(?P<timestamp>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4})
- timestamp:
source: timestamp
format: '2006-01-02T15:04:05-0700'