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

Use IMAP uid to retrieve new mails instead of "NOT SEEN" flag #36

Closed
wants to merge 16 commits into from
Closed

Use IMAP uid to retrieve new mails instead of "NOT SEEN" flag #36

wants to merge 16 commits into from

Conversation

prehor
Copy link
Contributor

@prehor prehor commented Mar 18, 2019

This PR introduces the following configuration options:

  • uid_tracking - set to true to use IMAP uid instead of "NOT SEEN" flag. defaults to false
  • sincedb_path - path to file with last processed IMAP uid. Defaults to <path.data>/plugins/inputs/imap

IMAP uid is always stored in the file sincedb_path regardles of the uid_tracking setting, so you can switch between "NOT SEEN" and "UID" tracking. In transition from the previous plugin version, first process at least one mail with uid_tracking set to false to save the last processed IMAP uid and then switch uid_tracking to true.

Fixies #31

(cherry picked from commit bdadb46)
This commit introduces new configuration options:
* `uid_tracking` - set to `true` to use IMAP uid instead of "NOT SEEN" flag
* `sincedb_path` - path to file with last processed IMAP uid. Defaults to
  `#{path.data}/plugins/input/imap/.sincedb_#{Digest::MD5.hexdigest("#{@user}_#{@host}_#{@PORT}_#{@folder}")}`

IMAP uid is always stored in the file `sincedb_path` regardles of the
`uid_tracking` setting, so we can switch between "NOT SEEN" and "UID"
tracking. In transition from the previous plugin version, we first need
to process at least one mail with `uid_tracking` set to `false` to save
the last processed IMAP uid and then switch `uid_tracking` to `true`.
@robbavey robbavey self-requested a review March 19, 2019 22:12
Copy link
Contributor

@robbavey robbavey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prehor Thanks for the contribution - this looks like a good addition to the plugin.

I have some minor requests, nothing too serious

lib/logstash/inputs/imap.rb Outdated Show resolved Hide resolved
lib/logstash/inputs/imap.rb Outdated Show resolved Hide resolved
lib/logstash/inputs/imap.rb Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@robbavey robbavey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I will merge and publish this change shortly. Thanks for the contribution!

@prehor
Copy link
Contributor Author

prehor commented Mar 22, 2019

Wait a minute please, a little improvement is on the way.

@robbavey robbavey self-assigned this Mar 26, 2019
@prehor
Copy link
Contributor Author

prehor commented Mar 29, 2019

Hi @robbavey, I'm done. Could you please review the changes?

Copy link
Contributor

@robbavey robbavey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good - @karenzone would you mind giving the docs a quick review?

Copy link
Contributor

@karenzone karenzone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc builds cleanly and LGTM. Thanks for taking time to update the docs with good descriptions, @prehor

@robbavey
Copy link
Contributor

@prehor Let me know if you are good with these changes being merged, and I will go ahead and merge and publish the gem.

Thanks again for the contribution!

@prehor
Copy link
Contributor Author

prehor commented Apr 25, 2019

I think that it is finished. Today I downloaded approximately 10.000 emails from Gmail and plugin was working well.

@elasticsearch-bot
Copy link

Rob Bavey merged this into the following branches!

Branch Commits
master 487dd0d, e1ada62, d86d84a, fe5b8c3, 8d691dd, f3bac92, 9554418, 0c4038b, 2ceaab7, a6a06f1, cb582ba, ea8d62e, e14c18b, e3c2e71, a162951, 3cd008c

elasticsearch-bot pushed a commit that referenced this pull request Apr 25, 2019
This commit introduces new configuration options:
* `uid_tracking` - set to `true` to use IMAP uid instead of "NOT SEEN" flag
* `sincedb_path` - path to file with last processed IMAP uid. Defaults to
  `#{path.data}/plugins/input/imap/.sincedb_#{Digest::MD5.hexdigest("#{@user}_#{@host}_#{@PORT}_#{@folder}")}`

IMAP uid is always stored in the file `sincedb_path` regardles of the
`uid_tracking` setting, so we can switch between "NOT SEEN" and "UID"
tracking. In transition from the previous plugin version, we first need
to process at least one mail with `uid_tracking` set to `false` to save
the last processed IMAP uid and then switch `uid_tracking` to `true`.

Fixes #36
elasticsearch-bot pushed a commit that referenced this pull request Apr 25, 2019
elasticsearch-bot pushed a commit that referenced this pull request Apr 25, 2019
elasticsearch-bot pushed a commit that referenced this pull request Apr 25, 2019
elasticsearch-bot pushed a commit that referenced this pull request Apr 25, 2019
elasticsearch-bot pushed a commit that referenced this pull request Apr 25, 2019
elasticsearch-bot pushed a commit that referenced this pull request Apr 25, 2019
elasticsearch-bot pushed a commit that referenced this pull request Apr 25, 2019
elasticsearch-bot pushed a commit that referenced this pull request Apr 25, 2019
elasticsearch-bot pushed a commit that referenced this pull request Apr 25, 2019
elasticsearch-bot pushed a commit that referenced this pull request Apr 25, 2019
elasticsearch-bot pushed a commit that referenced this pull request Apr 25, 2019
elasticsearch-bot pushed a commit that referenced this pull request Apr 25, 2019
@prehor
Copy link
Contributor Author

prehor commented Apr 25, 2019

Hi @robbavey . Thanks for your help. Could you please spend some time on my second PR #35? I just rebase it. Thanks.

@prehor prehor deleted the feature/uid_state branch April 25, 2019 21:31
@robbavey
Copy link
Contributor

@prehor Thanks for the pointer - I've just assigned it to myself to review and will take a look at it shortly. Thanks again!

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

Successfully merging this pull request may close these issues.

4 participants