Skip to content

Conversation

0golovatyi
Copy link
Contributor

Add new config param to turn on logging of request context: caller ip, client info, Tableau user name, TabPy user name.

@0golovatyi 0golovatyi added enhancement WIP Work in progress labels Apr 17, 2019
@0golovatyi 0golovatyi added this to the Authentication milestone Apr 17, 2019
@0golovatyi 0golovatyi self-assigned this Apr 17, 2019
Copy link
Contributor

@johng42 johng42 left a comment

Choose a reason for hiding this comment

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

Minor changes requested

'keyfile': self.settings[SettingsParameters.KeyFile]
})
else:
log_and_raise('Unsupported transfer protocol.', RuntimeError)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - we should log the transfer protocol in use here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! Added protocol to the message.

ConfigParameters.TABPY_LOG_DETAILS,
default_val='false')
self.settings[SettingsParameters.LogRequestContext] = (
self.settings[SettingsParameters.LogRequestContext].lower() !=
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be me, but this might read better if it was

    self.settings[SettingsParameters.LogRequestContext] = (
        self.settings[SettingsParameters.LogRequestContext].lower() ==
        'true')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about this and implemented it for the cases where the setting is anything but 'false', e.g. 'enable' or 'on'. However, I still need to updated documentation for the new setting so changing the logic as well.

return

if protocol != 'https':
log_and_raise('Unsupported transfer protocol: {}.'.format(
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks like dead code after running the first check in this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Check above for HTTP and this one is for HTTPS


protocol = self.settings['transfer_protocol']
protocol = self.settings[SettingsParameters.TransferProtocol]

Copy link
Contributor

Choose a reason for hiding this comment

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

we should log the protocol being set here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added logging.

str
Name of authentication method used by client.
If empty no authentication required.
Copy link
Contributor

Choose a reason for hiding this comment

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

these return value comments need clarification. For instance, we can return True, empty string - that means the auth method is found, but not used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With (True, '') it means there's no error in processing request and auth is not needed. Updating the documentation.

@0golovatyi
Copy link
Contributor Author

@nmannheimer Could you check documentation updates on this change?

@0golovatyi
Copy link
Contributor Author

Discussed all the @jnegara feedback with her, reached an agreement - no changes there :)

@0golovatyi 0golovatyi removed the WIP Work in progress label Apr 18, 2019
For extended logging (e.g. for auditing purposes) additional logging can be turned
on with setting `TABPY_LOG_DETAILS` configuration file parameter to `true`.

With the feature on additional information is logged for HTTP requests: caller ip,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be useful to say specifically that the client is Tableau/Tableau Server to make users aware that this will log usernames from Tableau Server.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll update the text together with the example below.


### Request Context Logging

For extended logging (e.g. for auditing purposes) additional logging can be turned
Copy link
Contributor

Choose a reason for hiding this comment

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

I would maybe say "additional logging details"

Copy link
Contributor

@johng42 johng42 left a comment

Choose a reason for hiding this comment

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

Ship it!

@johng42 johng42 merged commit c3a8327 into dev Apr 19, 2019
@johng42 johng42 deleted the dev_log_user branch April 19, 2019 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants