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

HTTP, Mail URL collector: log downloaded sizes #2554

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
- `intelmq.bots.collectors.shadowserver.collector_reports_api.py`:
- Fixed behaviour if parameter `types` value is empty string, behave the same way as not set, not like no type.
- `intelmq.bots.collectors.misp`: Use `PyMISP` class instead of deprecated `ExpandedPyMISP` (PR#2532 by Radek Vyhnal)
- `intelmq.bots.collectors.mail.collector_mail_url`: Fix import for Timeout exception preventing another exception (fixes #2555, PR#2556 by Sebastian Wagner).
- `intelmq.bots.collectors.http.collector_http`: Log the downloaded size in bytes to ease troubleshooting (PR#2554 by Sebastian Wagner).
- `intelmq.bots.collectors.mail.collector_mail_url`:
- Log the downloaded size in bytes to ease troubleshooting (PR#2554 by Sebastian Wagner).
- Fix import for Timeout exception preventing another exception (fixes #2555, PR#2556 by Sebastian Wagner).

#### Parsers
- `intelmq.bots.parsers.shadowserver._config`:
Expand Down
2 changes: 1 addition & 1 deletion intelmq/bots/collectors/http/collector_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def process(self):
self.logger.debug('Response body: %r.', resp.text)
raise ValueError('HTTP response status code was %i.' % resp.status_code)

self.logger.info("Report downloaded.")
self.logger.info("Report downloaded (%sB).", len(resp.content))

# PGP verification
if self.use_gpg:
Expand Down
2 changes: 1 addition & 1 deletion intelmq/bots/collectors/mail/collector_mail_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def process_message(self, uid, message):
if not resp.content:
self.logger.warning('Got empty response from server.')
else:
self.logger.info("Report downloaded.")
self.logger.info("Report downloaded (%sB).", len(resp.content))

template = self.new_report()
template["feed.url"] = url
Expand Down
1 change: 1 addition & 0 deletions intelmq/tests/bots/collectors/http/test_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def test_gzip(self, mocker):
output['feed.url'] = 'http://localhost/foobar.gz'
del output['extra.file_name']
self.assertMessageEqual(0, output)
self.assertLogMatches('Report downloaded \(29B\).', 'INFO')

def test_zip_auto(self, mocker):
"""
Expand Down
1 change: 1 addition & 0 deletions intelmq/tests/bots/collectors/mail/test_collector_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ def test_fetch(self, mocker):
with mock.patch('imbox.Imbox', new=MockedTxtImbox):
self.run_bot()
self.assertMessageEqual(0, REPORT_FOOBARTXT)
self.assertLogMatches('Report downloaded \(9B\).', 'INFO')
Loading