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

log more usefull in corporate environment #3237

Open
marmack95 opened this issue Nov 22, 2024 · 3 comments
Open

log more usefull in corporate environment #3237

marmack95 opened this issue Nov 22, 2024 · 3 comments

Comments

@marmack95
Copy link

marmack95 commented Nov 22, 2024

Hello,
i would like to use calibre-web to share pdf in my company.

In logs, i found:

  • who connect
  • which files were served
  • which files were downloaded

But i don't find who ask a file, and from which device...

On lines 1207, 1216 and 1237 of webp.py file, i replace:
log.info('Serving book: %s', data.name)
with:
log.info('Serving book: \'%s\' to %s - %s', data.name, current_user.name, request.headers.get('X-Forwarded-For', request.remote_addr))

On line 977 of helper.py, i replace:
log.info('Downloading file: {}'.format(os.path.join(filename, book_name + "." + book_format)))
with
log.info('Downloading file: \'%s\' by %s', format(os.path.join(filename, book_name + "." + book_format)), current_user.name)

But i don't find how add user ip address...

@OzzieIsaacs
Copy link
Collaborator

The address should be somewhere in the request structure (RemoteAddr)

@OzzieIsaacs
Copy link
Collaborator

Sorry, read it wrong, just add
from Flask import request
and the variable is available. I'll merge it hopefully this week

OzzieIsaacs added a commit that referenced this issue Dec 7, 2024
Refactored Response(json.dumps -> make_response(jsonify..)
Update mimetypes - Allow different mimetypes for download and file upload check (#3245, #3243)
Bugfixes from tests
Updated optional-requirements
OzzieIsaacs added a commit that referenced this issue Dec 7, 2024
Refactored Response(json.dumps -> make_response(jsonify..)
Update mimetypes - Allow different mimetypes for download and file upload check (#3245, #3243)
Bugfixes from tests
Updated optional-requirements
@OzzieIsaacs
Copy link
Collaborator

In the newest nightly versions, the ip address is logged in named cases

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