-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Input to read and parse a file every interval #3883
Comments
We're also stuck on a seemingly simple use case where AFAICT we bump into a (sometimes surprising) shortcoming in the existing tail & logparser input inputs. We have logfiles that have the date in their name and data in influx formatted lines. A solution would be if:
In addition to that, a setting to not only recreate the file list but also parse every file from the beginning at very interval would also fulfill the OP's request. Note that this may also prevent some of the confusion around the issues #1829 #2141 #2847 #3492, where I suspect that the cause could for instance be that inotify keeps references to files that get truncated, but "loses" the ones to files that get deleted and recreated. |
@dirkdevriendt Keep an eye on #3479, once we do this the next step will be to merge logparser and tail. |
The
and mabe few other options... I would also suggest to let users form sets (groups) sharing similar combination of these options for list of path resources (directory file from glob patterns) etc. It should also support the Golang glob patterns etc. I would also suggest to support separate configurations for the parsers (i.e. to let users maintain different rulesets for parsers for different groups (sets) of paths. I would also suggest to support not only regular files but also other types of objects (i.e. unix sockets). Maybe, this or similar way, the actual |
That's a lot of ideas, but I'd like to keep this plugin targeted at a common use case instead of making it into a jack of all trades plugin. I don't want to support directories directly, but the glob pattern can be used to match files instead. We can evaluate the glob pattern each interval or on a custom interval. All files matched should be sampled together each interval, I don't think we should try to introduce inotify. Continuous reading and last known position belong in tail. I'm also going to say no to running exec to preprocess, if you need this then use the exec plugin. Other changes to the configuration capabilities to reduce config verbosity and normalize the config need to be introduced as separate issues. You can use socket_listener for unix sockets. |
I have no real problem with it. For my use case some method to re-read and parse (using Grok) a file every interval is crutial atm. (see below). OT: If you like to keep the plugins and have, say,
I think that may be good-enough. The idea of supporting directories was to let user configure a directory to be watched itself and perform an action in case it changes (i.e. re-read list of files, update something, etc). But I can easily live without it personally. I just tried to stress most of the options that somebody would expect to have (IMHO) for such an input plugin. I do not need all of them personaly atm.
That would be good-enough. (I just completely forgot about the custom intervals, my fault.)
The inotify is quite a good mechanism and can be configured nicely too. 💡 I would like to suggest Telegraf had some sort of generic support for filesystem object change detection (for both files and directories and with misc. methods like In case you would not decide to go the way of merging
OK. But I am not sure whether I understand properly what this means.
Well, then the |
My plan is to merge logparser into tail, we will just have the tail plugin and this separate plugin. It turns out following a file is tricky, and the library we have been using has some issues, so I want to keep that type of logic out of this plugin.
This is #3479, you will be able to use Grok in any input that has a
It sounded like you have some ideas around changes to the general config file syntax, we can open new issues to discuss these but I don't want to tie the idea to this plugin, because it would delay the plugin unnecessarily.
It's in there now |
@danielnelson Thank you very much for clarification things more further.
That would be splendid! I am looking forward to it... |
Hello.
I would like to propose new input plugin to read and parse (Grok) a file every interval, preferably called
[[inputs.parser]]
(or[[inputs.reader]]
in case #3479 is planned to be done one day).The text was updated successfully, but these errors were encountered: