[Solved]Logparser Permissions are correct, there's still a permission error

telegraf
#1

The logparser has trouble getting the NGINX logs located at /var/log/nginx/*_access.log due to denied permissions.

Logparser output:
Nov 10 21:39:30 central telegraf[16781]: 2018-11-10T21:39:30Z E! Error in plugin [inputs.logparser]: open /var/log/nginx/stats_access.log: permission denied

File permissions:
-rw-r--r-- 1 www-data www-data 276585 Nov 10 00:19 /var/log/nginx/stats_access.log

telegraf user groups:
telegraf : telegraf www-data docker

Version: Telegraf 1.8.3 (git: HEAD f2979106)

I can provide further info if needed…

#2

Additionally, it doesn’t find any files by pattern /var/log/nginx/*_access.log unless i use /var/log/nginx/**.log

I have files that are matched by the pattern /var/log/nginx/*_access.log

Example:

ls -l /var/log/nginx/*_access.log                                                                                                                                                                                   
-rw-r--r-- 1 www-data www-data       0 Nov  8 06:25 /var/log/nginx/archive_access.log
-rw-r--r-- 1 www-data www-data       0 Nov  6 06:25 /var/log/nginx/cloud-test_access.log
-rw-r--r-- 1 www-data www-data 1365538 Nov 10 21:55 /var/log/nginx/cloud_access.log
-rw-r--r-- 1 www-data www-data       0 Oct 17 20:28 /var/log/nginx/daemon_access.log
-rw-r--r-- 1 www-data www-data       0 Oct 17 20:28 /var/log/nginx/db_access.log
-rw-r--r-- 1 www-data www-data     296 Nov 10 13:43 /var/log/nginx/dev_access.log
-rw-r--r-- 1 www-data www-data  168584 Nov 10 21:55 /var/log/nginx/download_access.log
-rw-r--r-- 1 www-data www-data       0 Oct 30 06:25 /var/log/nginx/fastdl_access.log
-rw-r--r-- 1 www-data www-data       0 Oct 29 06:25 /var/log/nginx/forum_access.log
-rw-r--r-- 1 www-data www-data 2078162 Nov 10 21:55 /var/log/nginx/grafana_access.log
-rw-r--r-- 1 www-data www-data     504 Nov 10 15:27 /var/log/nginx/homepage_access.log
-rw-r--r-- 1 www-data www-data       0 Oct 17 20:28 /var/log/nginx/portainer_access.log
-rw-r--r-- 1 www-data www-data  367798 Nov 10 21:55 /var/log/nginx/pterodactyl.app_access.log
-rw-r--r-- 1 www-data www-data  156415 Nov 10 21:55 /var/log/nginx/sourcebans_access.log
-rw-r--r-- 1 www-data www-data  276585 Nov 10 00:19 /var/log/nginx/stats_access.log
-rw-r--r-- 1 www-data www-data       0 Oct 17 20:28 /var/log/nginx/status_access.log
-rw-r--r-- 1 www-data www-data       0 Oct 17 20:28 /var/log/nginx/yagpdb_access.log
#3

Fixed it myself, had to run the service as root even if the parser had enough permissions, not sure what the reason behind it is.

1 Like