-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always use absolute path for event and registry #3328
Conversation
filebeat/harvester/log.go
Outdated
@@ -137,6 +137,7 @@ func (h *Harvester) Harvest(r reader.Reader) { | |||
event.InputType = h.config.InputType | |||
event.DocumentType = h.config.DocumentType | |||
event.JSONConfig = h.config.JSON | |||
event.Name = h.state.Fileinfo.Name() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this for discussion as it was requested several times in the past.
95a37cf
to
11d60f0
Compare
feac103
to
5fc6fc5
Compare
filebeat/_meta/fields.common.yml
Outdated
@@ -10,6 +10,11 @@ | |||
The file from which the line was read. This field contains the full path to the file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you drop the "absolute" keyword somewhere in the source
description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced full
with absolute
.
bcde6c0
to
c295289
Compare
filebeat/_meta/fields.common.yml
Outdated
For example: `/var/log/system.log`. | ||
|
||
- name: name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note sure about calling it "name" since it might ambiguous. How about "filename"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
c295289
to
ab1e217
Compare
I removed the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, waiting for green.
During some testing with filebeat I realised that when a relative path glob is put into the filebeat config, the event will contain the relative path and also the state. In most cases this should not be an issue and so far no issues were reported. For the state itself it is not an issue as they are compared based on inode/device. It could become an issue on restart in case a config was changed from a relative to an absolute path and the prospector does not detect, that the state would belong to the same prospector. This could also have an affect when migrating to this solutions. Old states could be left over in the registry file. But this requires, that someone was using relative paths before which was never recommended.
ab1e217
to
33ec85b
Compare
The default registry file must use an absolute path (elastic/beats#3328). This is probably a breaking change. Fixes #46
During some testing with filebeat I realised that when a relative path glob is put into the filebeat config, the event will contain the relative path and also the state. In most cases this should not be an issue and so far no issues were reported.
For the state itself it is not an issue as they are compared based on inode/device. It could become an issue on restart in case a config was changed from a relative to an absolute path and the prospector does not detect, that the state would belong to the same prospector. This could also have an affect when migrating to this solutions. Old states could be left over in the registry file. But this requires, that someone was using relative paths before.