Comments (14)
I upgraded the grok and so far I didnt see the error I used to see with previous release. Heading in right direction, but I would like to monitor for few more days to close this issue.
from grok_exporter.
This error occurs if the grok_exporter
process does not have the permission to open the log file. Could you double-check if the user running grok_exporter
can read the file?
from grok_exporter.
file permissions are okay because grok exporter comes up successfully and parses log files but when log file gets rotated-thats when its get killed. if permissions were problem, i would have seen issue when Im bringing up grok initially.
Log files have 755 permissions and grok has rwx for these files.
from grok_exporter.
How is your logrotate configured and which file system are you using?
from grok_exporter.
We are using rsyslog.d and here is the configuration 👍
[xxxx@ppppppp002c:/etc/rsyslog.d]> cat haproxy.conf
Saving application haproxy logs haproxy.log
$ModLoad imudp
$UDPServerRun 514
$UDPServerAddress 127.0.0.1
local0.* /var/prod/logs/yyyy/haproxy/tugs_hap.log
local1.* /var/prod/logs/yyyy/haproxy/http_hap.log
local2.* /var/prod/logs/yyyy/haproxy/securehttp_hap.log
local4.* /var/prod/logs/yyyy/haproxy/rest_hap.log
local5.* /var/prod/logs/yyyy/haproxy/ssl_hap.log
local6.* /var/prod/logs/yyyy/haproxy/caas_hap.log
[xxxx@ppppppp002c:/etc/rsyslog.d]>
from grok_exporter.
and the filesystem type is xfs
/dev/mapper/vg01-lvvarprodlogsxxxx /var/prod/logs/xxxx xfs defaults 1 2
from grok_exporter.
Maybe the error is related to how the rotated files like http_hap.log-20190529.gz
are created, and how the logfile http_hap.log
is re-created after rotation. Is rsyslog doing this in your case, or is logrotate running in addition to rsyslog to rotate the log files?
I am asking because rsyslog seems to support custom log rotation scripts (like here), and logrotate has a lot of configuration options how log files are rotated and re-created.
from grok_exporter.
Any best practices you can advice on the log rotation like moving the old file or copying? How is community handling these scenarios, I'm sure no one is maintaining one log file, which might fill up the disk space...Thoughts? In the meantime, I will get answers on rsyslog as it is handled by UNIX SA's in my company.
from grok_exporter.
Looks like it's both rsyslog and logrotate
and here is the logrotate configuration:
[xxxx@ppppppp002c:/etc/logrotate.d]> cat haproxy
/var/prod/logs/xxxx/haproxy/tugs_hap.log
/var/prod/logs/xxxx/haproxy/http_hap.log
/var/prod/logs/xxxx/haproxy/securehttp_hap.log
/var/prod/logs/xxxx/haproxy/rest_hap.log
/var/prod/logs/xxxx/haproxy/ssl_hap.log
/var/prod/logs/xxxx/haproxy/caas_hap.log
{
missingok
notifempty
sharedscripts
size 500M
rotate 4
daily
compress
postrotate
service rsyslog restart >/dev/null 2>&1 || true
endscript
create 0755 xxxx yyyy
}
[xxxx@ppppppp002c:/etc/logrotate.d]>
from grok_exporter.
This should work. Could you update to grok_exporter v0.2.7 and report if the error persists, and which error message you get with the current release?
from grok_exporter.
current error message : error reading log lines: failed to watch /var/prod/logs/xxxx/haproxy/http_hap.log: open /var/prod/logs/xxxx/haproxy/http_hap.log: permission denied
I will work on upgrade and report tomorrow . Thanks for your help.
from grok_exporter.
Even with new grok version- I'm still seeing the issue.
grok version: grok_exporter version: 0.2.7 (build date: 2019-04-08, branch: master, revision: e2ba841, go version: go1.12.2, platform: linux-amd64)
error reading log lines: /var/prod/logs/xxxx/haproxy/http_hap.log: failed to open file: open /var/prod/logs/xxxx/haproxy/http_hap.log: permission denied
Is this happening when log rotation is in progress and grok is trying to open file? anyway to ignore
from grok_exporter.
I checked where the error message is created in the grok_exporter
source code: I assume logrotate ran shortly before the error and moved the original http_hap.log
away. Then a new http_hap.log
was created. grok_exporter
detects the new file, tries to open it, and gets a permission denied error from the operating system. That causes the error.
As you say grok_exporter
can successfully read the file when you restart it, the permission denied error seems to be a temporary problem that occurs only shortly after the new file is created.
Could you check if you have ACLs configured for your file system? Maybe ACLs are causing a short delay until correct permissions are applied.
from grok_exporter.
Closing the issue as we found a work around by introducing a cronjob and more recently by moving to kubernetes.
from grok_exporter.
Related Issues (20)
- Feature Request: Option to specify ciphers or minimum TLS version HOT 2
- fail_on_missing_logfile for missing directories HOT 3
- Feature Request : Config option to expose metrics as a .prom file
- Issue reading Multiple files:
- how to match regex upper case/lower case insensitively
- Is grok able to watch only the latest log in dir?
- how to use regex group match and use matched group name label? HOT 1
- Can the latest version cover multi-line pattern match?
- if string exists HOT 7
- Use Gauge metric to find DB connectivity status HOT 1
- Exclude char HOT 2
- Does it support Elastic Search Open Distro HOT 1
- Configure for AWS ALB/CLB Logs or Cloudfront
- grok timestamp diffrent
- grok fails on insufficient permissions when fail_on_missing_logfile is false
- mutiple depth doc support HOT 1
- How can I use FuncMap to help transform data from the log, inside a template?
- Always report counter metric (initialize to zero) HOT 1
- match fails after encountering binary text within file
- Update or let someone else maintain this repo HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grok_exporter.