@emrah Hello! I wanted to ask you, is there any way to add this script to jitsi meet main web page like a button? I mean when you push a button, the script works and shows the information
i made your wonderful statistic script compatible to the new jitsi stable version; additionally, it shows on what bridge users were, who the admin has been (if secure domain enabled), and counts the number of members/ conferences in total.
#!/bin/bash
set -e
# -----------------------------------------------------------------------------
# jicofo-log-analyzer
# -----------------------------------------------------------------------------
# Analyzes the Jicofo log and generates a report.
# Copy to the /usr/local/bin folder and give the execute permission.
#
# cp jicofo-log-analyzer /usr/local/bin/
# chmod 755 /usr/local/bin/jicofo-log-analyzer
#
# usage:
# jicofo-log-analyzer /var/log/jitsi/jicofo.log > myreport.txt
# zcat /var/log/jitsi/jicofo.log.2.gz | jicofo-log-analyzer
# tail -f /var/log/jitsi/jicofo.log | jicofo-log-analyzer
# -----------------------------------------------------------------------------
LIST_MEMBERS=true
LIST_ACTIONS=true
MIN_DURATION="00:02:00"
MCOL=8
# count
declare -i count_confs count_users
if [[ -n "$1" ]]; then
LOG=$1
[[ ! -f "$LOG" ]] && exit 1
fi
declare -A created_at
declare -A disposed_at
declare -A members
declare -A actions
# -----------------------------------------------------------------------------
# elapsed time
# -----------------------------------------------------------------------------
function elapsed {
local t0=$(date -u -d "$1" +"%s")
local t1=$(date -u -d "$2" +"%s")
echo $(date -u -d "0 $t1 sec - $t0 sec" +"%H:%M:%S")
}
# -----------------------------------------------------------------------------
# list members
# -----------------------------------------------------------------------------
function list-members {
echo "participants:"
i=1
for m in $msorted; do
if [[ "$i" == 1 ]]; then
echo -n " $m"
(( i+=1 ))
elif [[ "$i" == "$MCOL" ]]; then
echo ", $m"
i=1
else
echo -n ", $m"
(( i+=1 ))
fi
done
[[ "$i" != "1" ]] && echo || true
}
# -----------------------------------------------------------------------------
# list actions
# -----------------------------------------------------------------------------
function list-actions {
echo "actions:"
while read act; do
echo " $act"
done < <(echo -e "${actions[$room]}")
}
# -----------------------------------------------------------------------------
# room created
# -----------------------------------------------------------------------------
function created {
created_at[$room]=$cdatetime
disposed_at[$room]=
actions[$room]="$ctime +++ [$room]"
members[$room]=
}
# -----------------------------------------------------------------------------
# room disposed
# -----------------------------------------------------------------------------
function disposed {
disposed_at[$room]=$cdatetime
actions[$room]+="\n$ctime --- [$room]"
duration=$(elapsed "${created_at[$room]}" "${disposed_at[$room]}")
[[ "$MIN_DURATION" > "$duration" ]] && return
msorted=$(echo ${members[$room]} | xargs -n1 | sort -u | xargs)
count_users+=`echo $msorted | wc -w`
count_confs+=1
# csv:
#$room;${created_at[$room]};${disposed_at[$room]};$duration;$(echo $msorted | wc -w);
cat <<EOF
$room
$(echo $room | sed 's/./=/g')
created at: ${created_at[$room]}
disposed at: ${disposed_at[$room]}
duration: $duration
number of participants: $(echo $msorted | wc -w)
EOF
[[ "$LIST_MEMBERS" == true ]] && list-members || true
[[ "$LIST_ACTIONS" == true ]] && list-actions || true
}
# -----------------------------------------------------------------------------
# main
# -----------------------------------------------------------------------------
while read l; do
cdatetime=$(echo $l | egrep -o '[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+')
ctime=$(echo $cdatetime | cut -d ' ' -f2)
room=$(echo $l | egrep -o 'room=[^[:space:]]*@' | cut -d '=' -f2 | cut -d '@' -f1)
if (echo $l | egrep -qs 'Member joined:'); then
member=$(echo $l | egrep -o 'joined:[^[:space:]]*' | cut -d':' -f2)
members[$room]+="$member "
actions[$room]+="\n$ctime -> $member"
elif (echo $l | egrep -qs 'bridge=jvbbrew.*@.*'); then
bridge=$(echo $l | egrep -o 'bridge=[^[:space:]]*@*' | cut -d '/' -f2)
actions[$room]+="\nBridge: $bridge"
elif (echo $l | egrep -qs 'AuthSession\[ID=.*@.*'); then
room2=$(echo $l | egrep -o 'R\=[^[:space:]]*@' | cut -d '=' -f2 | cut -d '@' -f1)
mod=$(echo $l | egrep -o 'AuthSession\[ID=[^[:space:]]*@[^[:space:]]*' | \
cut -d'=' -f2)
actions[$room2]+="\nAdmin: $mod"
elif (echo $l | egrep -qs 'Member .*@.* leaving'); then
member=$(echo $l | egrep -o '[^[:space:]]*@[^[:space:]]*' | \
cut -d'/' -f2)
members[$room]+="$member "
actions[$room]+="\n$ctime <- $member"
elif (echo $l | egrep -qs 'Granted owner to .*@.*'); then
member=$(echo $l | egrep -o '[^[:space:]]*@[^[:space:]]*' | \
cut -d'/' -f2)
actions[$room]+="\n$ctime * $member"
elif (echo $l | egrep -qs 'Created new conference,'); then
created
elif (echo $l | egrep -qs 'Stopped.'); then
disposed
fi
done < <(cat $LOG | egrep --line-buffered -s \
'(Member|Created|Stopped.|AuthSession|bridge=jvbbrew)')
echo
echo number of all participants: $count_users
echo number of all conferences: $count_confs
echo
echo created at $(date +'%Y-%m-%d %H:%M:%S')
I tested your analyzer, but I only get the first room in the log file, is there a way to have a full analysis of the full log to get the output for all the rooms?
Maybe I have something wrong in my settings because I see in the log several sessions finished also one that I made as test and the output prompts only the first one. Any idea? Or what is a finished session really?
In my test I opened my meet and created a room, copied the invitation and opened in another browser to enter as guest, I texted in the chat from the guest to the host and pressed log out button. Then I pressed log out button as guest and ran the script. The session isnât shown; but it is in /var/log/jitsi/jicofo.log as stopped
Dear @emrah,
for some reason, I ran the script with the command â./jicofo-log-analyzer-v2 /var/log/jitsi/jicofo.logâ
(your script is in the file jicofo-log-analyzer-v2)
and I got the following error:
: invalid optionlyzer-v2: line 2: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [â] [arg âŚ]
â: not a valid identifier line 22: declare: count_users ./jicofo-log-analyzer-v2: line 34: syntax error near unexpected token $â{\rââ
'/jicofo-log-analyzer-v2: line 34: ` function elapsed {