Monitoring User Events
This topic shows you how to query the PostgresSQL database that is embedded within the Cloudera Machine Learning deployment to monitor or audit user events.
This topic shows you how to query the PostgresSQL database that is embedded within the Cloudera Machine Learning deployment to monitor or audit user events.
root
. cdsw-master-host.
as
root
:ssh root@cdsw-master-host.yourcdswdomain.com
kubectl get pods -l role=db
NAME READY STATUS RESTARTS AGE
db-86bbb69b54-d5q88 1/1 Running 0 4h46m
sense
user: kubectl exec <database pod> -ti -- psql -U sense
db-86bbb69b54-d5q88
:
kubectl exec db-86bbb69b54-d5q88 -ti -- psql -U sense
sense
user.user_events
table.select * from user_events order by created_at DESC LIMIT 1
The
command returns information similar to the
following:
id | 3658
user_id | 273
ipaddr | ::ffff:127.0.0.1
user_agent | node-superagent/2.3.0
event_name | model created
description | {"model":"Simple Model 1559154287-ex5yn","modelId":"50","userType":"NORMAL","username":"DonaldBatz"}
created_at | 2019-05-29 18:24:47.65449
user_events
table to a CSV
file:copy user_events to '/tmp/user_events.csv' DELIMITER ',' CSV HEADER;
docker ps | grep db-86bbb
c56d04bbd58 c230b2f564da "docker-entrypoint..." 7 days ago Up 7 days k8s_db_db-86bbb69b54-fcfm6_default_8b2dd23d-88b9-11e9-bc34-0245eb679f96_0
The
first entry is the container ID.docker cp <container ID>:/tmp/user_events.csv /tmp/user_events.csv
For
example:
docker cp 8c56d04bbd58:/tmp/user_events.csv /tmp/user_events.csv
scp root@cdsw-master-host.yourcdswdomain.com:/tmp/user_events.csv /local/directory/events/