-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
in_tail: Expand glob capability for square brackets and one character matcher #4401
Conversation
Thanks! I'm concerned about backward compatibility. For example, if using the following configuration, is it necessary to change the setting? <source>
@type tail
path "/path/to/foo[bar]/test.log"
tag test
<parse>
@type none
</parse>
</source> I want to consider this point carefully. |
You are right. |
Once I implemented this feature, I didn't notice the backward compatibility issue and also macOS and Windows permit to use square brackets in their filesystems. So, we need to provide a switch for enabling this feature. |
9b26d31
to
1128f72
Compare
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
This is because square brackets are permitted to use filename in macOS and Windows. So, we need to take care of. Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1128f72
to
b5a7184
Compare
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.
Sorry for the delay, I've been busy with the 1.16 release.
Now, compatibility is OK, thanks!
I have 2 concerns about the specifications.
- Shouldn't we consider
exclude_paths
as well? use_extended_glob
option's name and feature are slightly inconsistent and confusing.- This is simply a feature about changing the condition to enable
Dir.glob
. - Whether this setting is
true
orfalse
,Dir.glob
itself remains the same.- For example, even if it is
false
, we can use[]
for glob as long aspath
includes*
.
- For example, even if it is
- Wouldn't it be more convenient and clearer to make a new option that just changes the condition to enable
Dir.glob
?- For example: the new option
enable_glob
.- Enum:
with_wildcard
(default),always
,no
with_wildcard
: Enabled if wildcards are included. (The current specification).always
: Always enabled.- We don't need to care about curly braces here. We should make it available to all who want to use it because we can avoid the collision by setting
path_delimiter
. We can explain it in the documentation or check it when we do@path.split(@path_delimiter)
and give a warning message, if it is needed.
- We don't need to care about curly braces here. We should make it available to all who want to use it because we can avoid the collision by setting
no
: Always disabled.- It would be natural for this option to exist.
- Enum:
- For example: the new option
- This is simply a feature about changing the condition to enable
Excellent! You are brilliant person. Yes, I'd love to handle that.
I'd prefer to use enum approach. Because switching with So, my recommendation is:
|
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
…n exclude paths Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
32dd445
to
926a700
Compare
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.
@cosmo0920 Thanks for fixing!
extended
: This should be more concrete name for that option. Because we didn't provide full set of the glob patterns on Dir.glob.
Is this about not supporting curly braces?
In my opinion, as I commented below, it would not be a problem to provide the full set.
We don't need to care about curly braces here. We should make it available to all who want to use it because we can avoid the collision by setting
path_delimiter
. We can explain it in the documentation or check it when we do@path.split(@path_delimiter)
and give a warning message, if it is needed.
In addition, even if path_delimiter
is the default value ,
, there seems to be no concern about causing the glob to fail because the path split is done first.
Do you have concerns about this?
However, I didn't fully follow your suggestion what "no" means here. Perhaps, you would be interested to collect
*
contained files with in_tail?
I understand your concern.
This option is not necessarily needed.
If you think you don't need it, let's remove it!
This may rarely actually help.
I just thought it would be natural to have an option to disable the feature completely.
We can add the option if we need it later.
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Yes. I will not support curly braces here. Because this is intended to extend a capability to handle square brackets in glob patterns only. This should be suitable for the first step to consider how extend the glob capabilities.
No, I experienced the feature collisions to support curly braces. This is because curly braces are usually used with comma
Sure. Let's remove on that choice from the |
I see.
Hmm, but it can be avoided by changing Rather, the point is whether it would negatively impact users who don't use curly braces. (users who want to use In summary, from the following three points, it seems to me that there is no need to narrow the conditions now.
What do you think? |
|
Additionally, if we were supporting the curly braces in in_tail, users should confuse how to specify |
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
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.
2. I **don't** think so. _The most of the functionality should work well out of the box without any additional settings._ Your suggestion is definitely opposite my concerns and recommendations.
Additionally, if we were supporting the curly braces in in_tail, users should confuse how to specify
path_delimiter
character. The current default character is,
. This should introduce the complexity which user must choose the delimiter that won't collide the divide the path for monitoring. I wish I could add this feature in this PR but adding a capability to handle curly braces introduces such complexity. If we had a cycle to support user forums and community, it would be nice to add. However, our supporting resource is limited for OSS version, right? So, I wouldn't prefer to add this feature.
Thanks for your explanation!
I see! I understand the points!
I don't feel we need to go that far in this case, but I understand it's a very important idea.
I understand your idea, so if there are no other opinions, I agree with your direction!
Note: Just to be clear, let me explain why I don't think so in this case.
- Including curly braces in the condition itself is not harmful.
- It only affects those who want to use curly braces.
- Simpler specifications are better for users.
- It is less confusing for users to say, "You can use all of them, so use whatever you like, but be careful when using curly braces", rather than having users understand that some characters are exceptions to the specification,
I understand the opinions on your side. Yeah, I'm always confusing how should I do/implement this newly implementing feature? Thanks for your suggestions. They are really helpful and well considered. You rock! 👍 |
I found that this approach could be effective for the most cases but I didn't tested them for corner cases yet. Mostly, Also, I feel that |
I'd also considered which name should be better but I didn't find any suitable and relatively shorter word. So, I just use |
I'm, not sure this commit makes to be able to handle the all of the glob patterns but mostly seems OK. Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
a3b0d0f
to
3ab56cc
Compare
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
implementing |
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.
Thanks for applying!
However, we need to fully discuss the name of this option and its specification.
I guess we haven't agreed on enough.
Let's discuss it before we consider implementation.
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
Thanks for your work!
I don't have further objection.
I understand the points!
Great!! It looks good to me. I have one concern about the name
Wouldn't users be more confused when they see this default value named If the priority is to make it easy for users to understand, it would be better to be able to assume the feature from the name.
What do you think about this? @cosmo0920 @kenhys |
I think that |
Why? It looks to me to be misleading as @kenhys is concerned:
Why? It may not confuse existing users, but wouldn't it confuse new users? |
As @kenhys said that this was intended to represent for extending regular expressions not only wildcard but for other expressions. But the current circumstances request to this option for only handling wildcard.
No, it would confuse new users. Because the default value should be representing backward compatible and the name should be noun. Not including verbs. Maybe perfect sentence would be effective but sometimes it makes redundant for the users. But, only using |
I see. I would also like to hear @kenhys's opinion.
I apologize. I didn't understand the nuance. 😢 |
How come bra bra? or How come? should be better instead of using why? |
And no worries. I'm not a native English speaker, neither. But I've been in an "immersion" environment in these years. |
I see! Thanks! I use English without understanding the nuances. That's difficult for me. 😢 I would very appreciate it if you would let me know if my English is impolite. |
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.
Thanks @kenhys !
|
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 commented on one question, but it's basically looks good to me.
Thanks so much for this enhancement!
…s option is chosen Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Because we can avoid the collisions for the tokens of comma usages. Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
19620d6
to
68e168c
Compare
Also, I found that the comment for curly braces is already outdated. I updated it, too. |
Merged! |
… matcher (fluent#4401) Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Which issue(s) this PR fixes:
This PR will fix none of the issue but this was raised in community slack channel.
What this PR does / why we need it:
This feature was requested on the community slack's #fluentd channel.
For now, we didn't support for square brackets pattern and one character matcher in #expand_paths.
This shouldn't be fit for the following case.
The logs are named as follows:
Then, a user wants to tail 02.log, 03.log, 12.log, and 13.log, and excluding to tail 01.log and 20.log with the following configuration:
However, the current Fluentd doesn't handle the "[0-1][2-3].log" pattern as glob. It just handles as normal file name.
This shouldn't be effective for this use case.
It would be nice to handle this pattern on the in_tail plugin.
Docs Changes:
fluent/fluentd-docs-gitbook#488
Release Note:
Same as title.