#!/usr/bin/python3
#
# Usage: ./list-logins-2 < /var/log/bigbluebutton/bbb-web.2020-05-06.log

import sys
import re
import json

for line in map(str.rstrip, sys.stdin):
    m = re.match('^(\S*).*data=(.*)$', line)
    if m:
        j = json.loads(m.group(2))
        if j['logCode'] in ('user_left_message', 'user_joined_message'):
            print('{:30} {:30} {}'.format(m.group(1), j['logCode'], j['username']))
