Skip to content
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: Watch only recently modified files #1466

Closed
t-osakada opened this issue Feb 15, 2017 · 1 comment
Closed

in_tail: Watch only recently modified files #1466

t-osakada opened this issue Feb 15, 2017 · 1 comment

Comments

@t-osakada
Copy link
Contributor

Would you consider adding an option like limit_recent_modified :time ?

The purpose of this option is to solve the following:

  • I want to skip logs of expiration when Fluentd stops for a long time due to failure or maintenance.

  • In addition, suppress unnecessary watcher creating to save resources.

ex.

     def expand_paths
       date = Time.now
       paths = []

       excluded = @exclude_path.map { |path| path = date.strftime(path); path.include?('*') ? Dir.glob(path) : pat\
h }.flatten.uniq
       @paths.each { |path|
         path = date.strftime(path)
         if path.include?('*')
           paths += Dir.glob(path).select { |p|
             if File.readable?(p) && !File.directory?(p)
-              true
+              if @limit_recent_modified and File.mtime(p) < (date - @limit_recent_modified)
+                false
+              else
+                true
+              end
             else
@repeatedly
Copy link
Member

It seems good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants