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.
This commit is contained in:
@@ -21,3 +21,34 @@ restic_include:
|
||||
restic_exclude:
|
||||
- /var/lib/nextcloud/data/*/files_trashbin
|
||||
- /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'
|
||||
|
||||
Reference in New Issue
Block a user