Show More
@@ -776,7 +776,8 b' def authenticate(username, password, env' | |||
|
776 | 776 | auth_time = time.time() - start |
|
777 | 777 | log.debug('Authentication for plugin `%s` completed in %.4fs, ' |
|
778 | 778 | 'expiration time of fetched cache %.1fs.', |
|
779 |
plugin.get_id(), auth_time, cache_ttl |
|
|
779 | plugin.get_id(), auth_time, cache_ttl, | |
|
780 | extra={"plugin": plugin.get_id(), "time": auth_time}) | |
|
780 | 781 | |
|
781 | 782 | log.debug('PLUGIN USER DATA: %s', plugin_user) |
|
782 | 783 | |
@@ -785,7 +786,12 b' def authenticate(username, password, env' | |||
|
785 | 786 | if plugin_user: |
|
786 | 787 | log.debug('Plugin returned proper authentication data') |
|
787 | 788 | if statsd: |
|
789 | elapsed_time_ms = round(1000.0 * auth_time) # use ms only | |
|
788 | 790 | statsd.incr('rhodecode_login_success_total') |
|
791 | statsd.timing("rhodecode_login_timing.histogram", elapsed_time_ms, | |
|
792 | tags=["plugin:{}".format(plugin.get_id())], | |
|
793 | use_decimals=False | |
|
794 | ) | |
|
789 | 795 | return plugin_user |
|
790 | 796 | |
|
791 | 797 | # we failed to Auth because .auth() method didn't return proper user |
@@ -222,7 +222,8 b' class RhodeCodeAuthPlugin(RhodeCodeExter' | |||
|
222 | 222 | 'extern_type': extern_type, |
|
223 | 223 | } |
|
224 | 224 | |
|
225 |
log.info('user `%s` authenticated correctly', user_attrs['username'] |
|
|
225 | log.info('user `%s` authenticated correctly', user_attrs['username'], | |
|
226 | extra={"action": "user_auth_ok", "module": "auth_headers", "username": user_attrs["username"]}) | |
|
226 | 227 | return user_attrs |
|
227 | 228 | |
|
228 | 229 |
@@ -534,7 +534,8 b' class RhodeCodeAuthPlugin(RhodeCodeExter' | |||
|
534 | 534 | } |
|
535 | 535 | |
|
536 | 536 | log.debug('ldap user: %s', user_attrs) |
|
537 |
log.info('user `%s` authenticated correctly', user_attrs['username'] |
|
|
537 | log.info('user `%s` authenticated correctly', user_attrs['username'], | |
|
538 | extra={"action": "user_auth_ok", "module": "auth_ldap", "username": user_attrs["username"]}) | |
|
538 | 539 | |
|
539 | 540 | return user_attrs |
|
540 | 541 |
@@ -162,7 +162,8 b' class RhodeCodeAuthPlugin(RhodeCodeExter' | |||
|
162 | 162 | pass |
|
163 | 163 | |
|
164 | 164 | log.debug("pamuser: %s", user_attrs) |
|
165 |
log.info('user `%s` authenticated correctly', user_attrs['username'] |
|
|
165 | log.info('user `%s` authenticated correctly', user_attrs['username'], | |
|
166 | extra={"action": "user_auth_ok", "module": "auth_pam", "username": user_attrs["username"]}) | |
|
166 | 167 | return user_attrs |
|
167 | 168 | |
|
168 | 169 |
@@ -167,11 +167,13 b' class RhodeCodeAuthPlugin(RhodeCodeAuthP' | |||
|
167 | 167 | |
|
168 | 168 | if userobj.username == User.DEFAULT_USER and userobj.active: |
|
169 | 169 | log.info('user `%s` authenticated correctly as anonymous user', |
|
170 |
userobj.username |
|
|
170 | userobj.username, | |
|
171 | extra={"action": "user_auth_ok", "module": "auth_rhodecode_anon", "username": userobj.username}) | |
|
171 | 172 | return user_attrs |
|
172 | 173 | |
|
173 | 174 | elif userobj.username == username and password_match: |
|
174 |
log.info('user `%s` authenticated correctly', userobj.username |
|
|
175 | log.info('user `%s` authenticated correctly', userobj.username, | |
|
176 | extra={"action": "user_auth_ok", "module": "auth_rhodecode", "username": userobj.username}) | |
|
175 | 177 | return user_attrs |
|
176 | 178 | log.warning("user `%s` used a wrong password when " |
|
177 | 179 | "authenticating on this plugin", userobj.username) |
@@ -252,7 +252,7 b' class Lock(object):' | |||
|
252 | 252 | logger.warning("Failed to get %r.", self._name) |
|
253 | 253 | return False |
|
254 | 254 | |
|
255 |
logger. |
|
|
255 | logger.debug("Got lock for %r.", self._name) | |
|
256 | 256 | if self._lock_renewal_interval is not None: |
|
257 | 257 | self._start_lock_renewer() |
|
258 | 258 | return True |
@@ -284,7 +284,9 b' def store(action, user, action_data=None' | |||
|
284 | 284 | sa_session.commit() |
|
285 | 285 | |
|
286 | 286 | log.info('AUDIT[%s]: Logging action: `%s` by user:id:%s[%s] ip:%s', |
|
287 |
entry_id, action_name, user_id, username, ip_address |
|
|
287 | entry_id, action_name, user_id, username, ip_address, | |
|
288 | extra={"entry_id": entry_id, "action": action_name, | |
|
289 | "user_id": user_id, "ip": ip_address}) | |
|
288 | 290 | |
|
289 | 291 | except Exception: |
|
290 | 292 | log.exception('AUDIT: failed to store audit log') |
@@ -1490,7 +1490,8 b' class AuthUser(object):' | |||
|
1490 | 1490 | return True |
|
1491 | 1491 | else: |
|
1492 | 1492 | log.info('Access for IP:%s forbidden for user %s, ' |
|
1493 |
'not in %s', ip_addr, user_id, allowed_ips |
|
|
1493 | 'not in %s', ip_addr, user_id, allowed_ips, | |
|
1494 | extra={"ip": ip_addr, "user_id": user_id}) | |
|
1494 | 1495 | return False |
|
1495 | 1496 | |
|
1496 | 1497 | def get_branch_permissions(self, repo_name, perms=None): |
@@ -112,7 +112,7 b' class DbManage(object):' | |||
|
112 | 112 | else: |
|
113 | 113 | destroy = self.ask_ok('Are you sure that you want to destroy the old database? [y/n]') |
|
114 | 114 | if not destroy: |
|
115 | log.info('Nothing done.') | |
|
115 | log.info('db tables bootstrap: Nothing done.') | |
|
116 | 116 | sys.exit(0) |
|
117 | 117 | if destroy: |
|
118 | 118 | Base.metadata.drop_all() |
@@ -54,17 +54,20 b' class RequestWrapperTween(object):' | |||
|
54 | 54 | _ver_ = rhodecode.__version__ |
|
55 | 55 | _path = safe_str(get_access_path(request.environ)) |
|
56 | 56 | _auth_user = self._get_user_info(request) |
|
57 | ip = get_ip_addr(request.environ) | |
|
58 | match_route = request.matched_route.name if request.matched_route else "NOT_FOUND" | |
|
57 | 59 | |
|
58 | 60 | total = time.time() - start |
|
59 | 61 | log.info( |
|
60 | 62 | 'Req[%4s] %s %s Request to %s time: %.4fs [%s], RhodeCode %s', |
|
61 | 63 | count, _auth_user, request.environ.get('REQUEST_METHOD'), |
|
62 | _path, total, get_user_agent(request. environ), _ver_ | |
|
64 | _path, total, get_user_agent(request. environ), _ver_, | |
|
65 | extra={"time": total, "ver": _ver_, "ip": ip, | |
|
66 | "path": _path, "view_name": match_route} | |
|
63 | 67 | ) |
|
64 | 68 | |
|
65 | 69 | statsd = request.registry.statsd |
|
66 | 70 | if statsd: |
|
67 | match_route = request.matched_route.name if request.matched_route else "NOT_FOUND" | |
|
68 | 71 | resp_code = getattr(response, 'status_code', 'UNDEFINED') |
|
69 | 72 | elapsed_time_ms = round(1000.0 * total) # use ms only |
|
70 | 73 | statsd.timing( |
@@ -121,11 +121,11 b' class RhodeCodeCacheRegion(CacheRegion):' | |||
|
121 | 121 | def get_or_create_for_user_func(key_generator, user_func, *arg, **kw): |
|
122 | 122 | |
|
123 | 123 | if not condition: |
|
124 |
log.debug('Calling un-cached |
|
|
124 | log.debug('Calling un-cached method:%s', user_func.func_name) | |
|
125 | 125 | start = time.time() |
|
126 | 126 | result = user_func(*arg, **kw) |
|
127 | 127 | total = time.time() - start |
|
128 |
log.debug('un-cached |
|
|
128 | log.debug('un-cached method:%s took %.4fs', user_func.func_name, total) | |
|
129 | 129 | return result |
|
130 | 130 | |
|
131 | 131 | key = key_generator(*arg, **kw) |
@@ -133,7 +133,7 b' class RhodeCodeCacheRegion(CacheRegion):' | |||
|
133 | 133 | timeout = expiration_time() if expiration_time_is_callable \ |
|
134 | 134 | else expiration_time |
|
135 | 135 | |
|
136 |
log.debug('Calling cached |
|
|
136 | log.debug('Calling cached method:`%s`', user_func.func_name) | |
|
137 | 137 | return self.get_or_create(key, user_func, timeout, should_cache_fn, (arg, kw)) |
|
138 | 138 | |
|
139 | 139 | def cache_decorator(user_func): |
General Comments 0
You need to be logged in to leave comments.
Login now