2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								#!/usr/bin/env bash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								###
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# JItsi Log Observer - command line interface
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Bash script for Jitsi Meet components (Videobridge, Jicofo, etc.) logs parsing
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Command line interface (jilo-cli)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								###
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								VERSION="0.1.1-dev"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								RELEASE_DATE="unreleased"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 16:07:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 17:38:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" #"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								### Configuration file (overrides default configs)
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 17:38:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								CONFIG_FILE="$SCRIPT_DIR/jilo.conf"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Default configuration
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Default database type (sqlite, mysql|mariadb)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								DEFAULT_DB_TYPE="sqlite"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Default SQLite database file
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 17:38:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								DEFAULT_DB="$SCRIPT_DIR/jilo.db"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# Default MySQL/MariaDB configuration
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								DEFAULT_MYSQL_HOST="localhost"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								DEFAULT_MYSQL_USER="jilo"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								DEFAULT_MYSQL_PASS="jilopass"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								DEFAULT_MYSQL_DB="jilo_db"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								DEFAULT_NORMAL_TEXT="\033[0m"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								DEFAULT_IMPORTANT_TEXT="\033[1m"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# Load configurations from the config file if it exists
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if [[ -f "$CONFIG_FILE" ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    source "$CONFIG_FILE"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# use default values if not overriden by config file
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								DB=${DB:-$DEFAULT_DB}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								DB_TYPE=${DB_TYPE:-$DEFAULT_DB_TYPE}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								MYSQL_HOST=${MYSQL_HOST:-$DEFAULT_MYSQL_HOST}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								MYSQL_USER=${MYSQL_USER:-$DEFAULT_MYSQL_USER}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								MYSQL_PASS=${MYSQL_PASS:-$DEFAULT_MYSQL_PASS}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								MYSQL_DB=${MYSQL_DB:-$DEFAULT_MYSQL_DB}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								NORMAL_TEXT=${NORMAL_TEXT:-$DEFAULT_NORMAL_TEXT}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								IMPORTANT_TEXT=${IMPORTANT_TEXT:-$DEFAULT_IMPORTANT_TEXT}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### DB queries
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## conference related
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								db_conferences_all_formatted_template="
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 17:45:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								SELECT DISTINCT
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    c.jitsi_component,
							 
						 
					
						
							
								
									
										
										
										
											2024-06-17 10:30:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    (SELECT ce.time
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        FROM conference_events ce
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ce.conference_id = c.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            AND
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ce.conference_event = 'conference expired')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    AS start,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    (SELECT ce.time
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        FROM conference_events ce
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ce.conference_id = c.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            AND
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ce.conference_event = 'conference created')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    AS end,
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
									
										
										
										
											2024-06-17 10:30:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    (SELECT COUNT(pe.participant_id) AS participants
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        FROM participant_events pe
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            pe.event_type = 'participant joining'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            AND
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            pe.event_param = c.conference_id),
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    name_counts.name_count,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								JOIN (
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        COUNT(*) AS name_count
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        conferences
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    GROUP BY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        conference_name
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								) AS name_counts ON c.conference_name = name_counts.conference_name
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE (ce.time >= '%s' AND ce.time <= '%s')
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ORDER BY
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    c.id;"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								db_conference_by_id_template="
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time,
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 17:00:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    pe.loglevel,
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 17:00:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    pe.event_type,
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    p.endpoint_id AS participant_id,
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 17:00:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    pe.event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participants p ON c.conference_id = p.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participant_events pe ON p.endpoint_id = pe.participant_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id = '%s'
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								AND (pe.time >= '%s' AND pe.time <= '%s')
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								UNION
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.time AS event_time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_event AS event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    NULL AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_param AS event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id = '%s'
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								AND (event_time >= '%s' AND event_time <= '%s')
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 17:00:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ORDER BY
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    pe.time;"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								db_conference_by_name_template="
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time,
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 17:00:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    pe.loglevel,
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 17:00:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    pe.event_type,
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    p.endpoint_id AS participant_id,
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 17:00:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    pe.event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participants p ON c.conference_id = p.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participant_events pe ON p.endpoint_id = pe.participant_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name = '%s'
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								AND (pe.time >= '%s' AND pe.time <= '%s')
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 17:00:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								UNION
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.time AS event_time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_event AS event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    NULL AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_param AS event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name = '%s'
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								AND (event_time >= '%s' AND event_time <= '%s')
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ORDER BY
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    pe.time;"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## participant related
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								db_participants_all_template="
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT DISTINCT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p.jitsi_component, p.endpoint_id, p.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participants p
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participant_events pe ON p.endpoint_id = pe.participant_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time >= '%s' AND pe.time <= '%s'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ORDER BY p.id;"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								db_conference_by_participant_id_template="
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p.endpoint_id AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participants p ON c.conference_id = p.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participant_events pe ON p.endpoint_id = pe.participant_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p.endpoint_id = '%s'
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								AND (pe.time >= '%s' AND pe.time <= '%s')
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								UNION
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.time AS event_time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_event AS event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    NULL AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_param AS event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participant_id = '%s'
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								AND (event_time >= '%s' AND event_time <= '%s')
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ORDER BY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time;"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								db_participant_by_conference_id_template="
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p.endpoint_id AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participants p ON c.conference_id = p.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participant_events pe ON p.endpoint_id = pe.participant_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    c.conference_id = '%s'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								AND (pe.time >= '%s' AND pe.time <= '%s')
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								UNION
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.time AS event_time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_event AS event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    NULL AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_param AS event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ce.conference_id = '%s'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								AND (event_time >= '%s' AND event_time <= '%s')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ORDER BY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time;"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								db_participant_by_conference_name_template="
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p.endpoint_id AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participants p ON c.conference_id = p.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participant_events pe ON p.endpoint_id = pe.participant_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name LIKE '%%%s%%'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								AND (pe.time >= '%s' AND pe.time <= '%s')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								UNION
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.time AS event_time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_event AS event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    NULL AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_param AS event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE c.conference_name LIKE '%%%s%%'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								AND (event_time >= '%s' AND event_time <= '%s')
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ORDER BY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time;"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								db_participant_by_stats_id_template="
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p.endpoint_id AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participants p ON c.conference_id = p.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participant_events pe ON p.endpoint_id = pe.participant_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_type = 'stats_id' AND pe.event_param LIKE '%%%s%%'
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								AND (pe.time >= '%s' AND pe.time <= '%s')
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								UNION
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.time AS event_time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_event AS event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    NULL AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_param AS event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    event_type = 'stats_id' AND event_param LIKE '%%%s%%'
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								AND (event_time >= '%s' AND event_time <= '%s')
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ORDER BY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time;"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								db_participant_by_ip_template="
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p.endpoint_id AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participants p ON c.conference_id = p.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participant_events pe ON p.endpoint_id = pe.participant_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_type = 'pair selected' AND pe.event_param = '%s'
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								AND (pe.time >= '%s' AND pe.time <= '%s')
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								UNION
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.time AS event_time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_event AS event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    NULL AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_param AS event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    event_type = 'pair selected' AND event_param = '%s'
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								AND (event_time >= '%s' AND event_time <= '%s')
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ORDER BY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time;"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:43:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## time period related
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 12:08:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								db_events_by_period_template="
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p.endpoint_id AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participants p ON c.conference_id = p.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    participant_events pe ON p.endpoint_id = pe.participant_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time >= '%s' AND pe.time <= '%s'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								UNION
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.time AS event_time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_name,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c.conference_host,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.loglevel,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_event AS event_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    NULL AS participant_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ce.conference_param AS event_param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conferences c
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LEFT JOIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    conference_events ce ON c.conference_id = ce.conference_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    event_time >= '%s' AND event_time <= '%s'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ORDER BY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pe.time;"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 12:25:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								help="Usage:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $0 [OPTION]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    Options:
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:43:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        --conference|-c [conference ID or name] - show specific conference(s), all of empty
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        --participant|-p [participant endpoint ID, conference ID, conference name, participant IP, or participant stats ID] - show specific participant(s), all if empty
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        --time|-t - show stats for a time interval; can be use separately ot together with -c or -p
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        --verbose|-v - show more details, when available
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        --silent|-s - show less details, more suitable for scripting
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 16:07:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        --help|-h - show this help message
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        --version|-V - show version"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								version="JILO Jitsi Logs Observer command line client
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    jilo-cli_${VERSION}_${RELEASE_DATE}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    version $VERSION
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    released on $RELEASE_DATE"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								time_formats="Expected formats:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								- exact times
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    YYYY-MM-DD, YYYY-MM, YYYY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								- exact periods
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    YYYY-MM-DD:YYYY-MM-DD, YYYY-MM:YYYY-MM, YYYY:YYYY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								- from begining to given time
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    :YYYY-MM-DD, :YYYY-MM, :YYYY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								- from given time until end
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    YYYY-MM-DD:, YYYY-MM:, YYYY:"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								###
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# First we check for requirements
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								check_requirements() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # required programs, anything non-bash - edit as needed
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:29:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    # deb packages - sqlite3, util-linux (column)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    local required_programs=("sqlite3" "column")
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    local requirements_missing=''
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for program in "${required_programs[@]}"; do
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ! command -v "$program" &> /dev/null; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            requirements_missing+="$program, "
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if [[ "$requirements_missing" != '' ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        requirements_missing=${requirements_missing::-2}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        echo "Error: $requirements_missing - not found. Please install to proceed."
							 
						 
					
						
							
								
									
										
										
										
											2024-06-06 07:30:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        exit 1
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								check_requirements
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								###
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# DB functions for Sqlite3 and for MySQL/MariaDB
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# execute a query and return the result
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								db_query() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    local query=$1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if [[ "$DB_TYPE" == "sqlite" ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        sqlite3 "$DB" "$query"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    elif [[ "$DB_TYPE" == "mysql" || "$DB_TYPE" == "mariadb" ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mysql -h "$MYSQL_HOST" -u "$MYSQL_USER" -p "$MYSQL_PASS" -D "$MYSQL_DB" -se "$query"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        echo "Error: unknown database type $DB_TYPE."
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        exit 1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:43:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### input parameters parsing
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# time parameters
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								parse_time_range() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    local time_range="$1"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ## exact times
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # exact date given (YYYY-MM-DD)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if [[ "$time_range" =~ ^([0-9]{4})-([0-9]{2})-([0-9]{2})$ ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        from_time="${BASH_REMATCH[0]}"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        until_time="${BASH_REMATCH[0]}"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # exact month given (YYYY-MM)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    elif [[ "$time_range" =~ ^([0-9]{4})-([0-9]{2})$ ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        from_time="${BASH_REMATCH[0]}-01"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        until_time="${BASH_REMATCH[0]}-31"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # exact year given (YYYY)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    elif [[ "$time_range" =~ ^([0-9]{4})$ ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        from_time="${BASH_REMATCH[0]}-01-01"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        until_time="${BASH_REMATCH[0]}-12-31"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ## exact periods
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # from date to date
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    elif [[ "$time_range" =~ ^([0-9]{4})-([0-9]{2})-([0-9]{2}):([0-9]{4})-([0-9]{2})-([0-9]{2})$ ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        from_time="${BASH_REMATCH[1]}-${BASH_REMATCH[2]}-${BASH_REMATCH[3]}"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        until_time="${BASH_REMATCH[4]}-${BASH_REMATCH[5]}-${BASH_REMATCH[6]}"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # from month to month
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    elif [[ "$time_range" =~ ^([0-9]{4})-([0-9]{2}):([0-9]{4})-([0-9]{2})$ ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        from_time="${BASH_REMATCH[1]}-${BASH_REMATCH[2]}-01"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        until_time="${BASH_REMATCH[3]}-${BASH_REMATCH[4]}-31"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # from year to year
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    elif [[ "$time_range" =~ ^([0-9]{4}):([0-9]{4})$ ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        from_time="${BASH_REMATCH[1]}-01-01"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        until_time="${BASH_REMATCH[2]}-12-31"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ## only end time given
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # from begining until date (:YYYY-MM-DD)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    elif [[ "$time_range" =~ ^:([0-9]{4})-([0-9]{2})-([0-9]{2})$ ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        from_time="0000-01-01"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        until_time="${BASH_REMATCH[1]}-${BASH_REMATCH[2]}-${BASH_REMATCH[3]}"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # from begining until month (:YYYY-MM)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    elif [[ "$time_range" =~ ^:([0-9]{4})-([0-9]{2})$ ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        from_time="0000-01-01"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        until_time="${BASH_REMATCH[1]}-${BASH_REMATCH[2]}-31"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # from begining until year (:YYYY)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    elif [[ "$time_range" =~ ^:([0-9]{4})$ ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        from_time="0000-01-01"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        until_time="${BASH_REMATCH[0]}-12-31"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ## only start time given
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # from date until end (YYYY-MM-DD:)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    elif [[ "$time_range" =~ ^([0-9]{4})-([0-9]{2})-([0-9]{2}):$ ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        from_time="${BASH_REMATCH[1]}-${BASH_REMATCH[2]}-${BASH_REMATCH[3]}"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        until_time="9999-12-31"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # from month until end (YYYY-MM:)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    elif [[ "$time_range" =~ ^([0-9]{4})-([0-9]{2}):$ ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        from_time="${BASH_REMATCH[1]}-${BASH_REMATCH[2]}-01"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        until_time="9999-12-31"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # from year until end (YYYY:)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    elif [[ "$time_range" =~ ^([0-9]{4}):$ ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        from_time="${BASH_REMATCH[1]}-01-01"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        until_time="9999-12-31"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        echo -e "Invalid time range. $time_formats" >&2
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:43:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        exit 1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    time_range_specified=true
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-17 10:30:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# we have two timestamps in format YYYY-MM-DD HH:MM:SS.sss
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# calculate and return the durtion in format HH:MM:SS
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								calculate_duration() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    start=$(date -d "$1" +"%s")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    end=$(date -d "$2" +"%s")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    duration_seconds=$((end - start))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    hours=$((duration_seconds / 3600))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    duration_seconds_remain=$((duration_seconds % 3600))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    minutes=$((duration_seconds_remain / 60))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    seconds=$((duration_seconds_remain % 60))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # add leading zeroes
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    duration=$(printf "%02d:%02d:%02d" $hours $minutes $seconds)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 11:35:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### commandline options
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 12:25:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								conference_arg=""
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								conference_option=false
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 12:25:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								participant_arg=""
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								participant_option=false
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								from_time="0000-00-00"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								until_time="9999-12-31"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								time_option=false
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:43:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								time_range_specified=false
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 11:35:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# display help if no arguments
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if [[ $# -eq 0 ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo -e "$help"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    exit 0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# then check all the options
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 11:35:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								while  [[ $# -gt 0 ]]; do
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    case "$1" in
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 12:25:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        -c | --conference )
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            conference_option=true
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 11:52:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if [[ -n "$2" && "$2" != -* ]]; then
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 12:25:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                conference_arg="$2"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 11:52:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                shift 2
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            else
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                shift
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            ;;
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 12:25:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        -p | --participant)
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            participant_option=true
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 12:25:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if [[ -n "$2" && "$2" != -* ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                participant_arg="$2"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                shift 2
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            else
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                shift
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            ;;
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 11:35:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        -t | --time)
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            time_option=true
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:43:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if [[ -n "$2" && "$2" != -* ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                parse_time_range "$2"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                shift 2
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            else
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                echo "Option -t needs a time range argument. $time_formats" >&2
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:43:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                exit 1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 11:35:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            ;;
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        -v | --verbose)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            verbose=true
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            shift
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ;;
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        -s | --silent)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            silent=true
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            shift
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ;;
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 11:35:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        -h | --help)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            echo -e "$help"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            exit 0
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            ;;
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 16:07:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        -V | --version)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            echo -e "$version"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            exit 0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ;;
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 11:35:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        *)
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 11:52:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            echo "Invalid option: $1" >&2
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            echo -e "$help"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            exit 1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ;;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    esac
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if [[ "$conference_option" == true ]]; then
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    # the argument to "--conference" can be either ID or name
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if [[ -n "$conference_arg" ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        # check for conferences match within a time period (or all if not period given)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        db_conferences_id=$(printf "$db_conference_by_id_template" "$conference_arg" "$from_time" "$until_time" "$conference_arg" "$from_time" "$until_time")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mapfile -t conferences_id < <(db_query "$db_conferences_id")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        db_conferences_name=$(printf "$db_conference_by_name_template" "$conference_arg" "$from_time" "$until_time" "$conference_arg" "$from_time" "$until_time")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mapfile -t conferences_name < <(db_query "$db_conferences_name")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        # we check if the argument to "--conference" is a conference ID
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        # conference ID is unique, so we show that conference
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if [[ "${#conferences_id[@]}" -gt 0 ]]; then
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            output=""
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the header
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header="\nConferences with ID matching \"$IMPORTANT_TEXT$conference_arg$NORMAL_TEXT\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    header+=" for the time period \"$from_time - $until_time\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header+="\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo -e "$header"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the formatted rows
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            for row in "${conferences_id[@]}"; do
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="$time\t$IMPORTANT_TEXT$conference_id$NORMAL_TEXT\t$conference_name\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$event_param\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # output
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            echo -e "$output" | column -t -s $'\t'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        # then we check if the argument to "--conference" is a conference name
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        # if so, we show all matching conferences (conference names are not unique)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        elif [[ "${#conferences_name[@]}" -gt 0 ]]; then
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            output=""
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the header
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header="\nConferences with names matching \"$IMPORTANT_TEXT$conference_arg$NORMAL_TEXT\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    header+=" for the time period \"$from_time - $until_time\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header+="\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo -e "$header"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output="time\tconf ID\tconf name\tconf host\tloglevel\tparticipant ID\tevent\tparameter\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the formatted rows
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            for row in "${conferences_name[@]}"; do
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="$time\t$conference_id\t$IMPORTANT_TEXT$conference_name$NORMAL_TEXT\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$event_param\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # output
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            echo -e "$output" | column -t -s $'\t'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        # nothing found for neither conference ID or name
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 11:52:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        else
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo "No match found for \"$conference_arg\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    echo "and time period $from_time - $until_time"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        exit 0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        # if no argument is given, we show all the conferences
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        db_conferences_all=$(printf "$db_conferences_all_formatted_template" "$from_time" "$until_time")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mapfile -t conference_array < <(db_query "$db_conferences_all")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        # we only format the outrput if there are conferences to show
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if [[ "${#conference_array[@]}" -gt 0 ]]; then
							 
						 
					
						
							
								
									
										
										
										
											2024-06-15 07:05:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            output=""
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the header
							 
						 
					
						
							
								
									
										
										
										
											2024-06-15 07:05:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header="\nAll conferences"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    header+=" for the time period \"$IMPORTANT_TEXT$from_time - $until_time$NORMAL_TEXT\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header+="\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo -e "$header"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-17 10:30:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                output="component\tduration\tconference ID\tconference name\tparticipants\tname count\tconference host\n"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-15 07:05:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the formatted rows
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            for row in "${conference_array[@]}"; do
							 
						 
					
						
							
								
									
										
										
										
											2024-06-17 10:30:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                IFS='|' read -r jitsi_component end start conference_id conference_name participants name_count conference_host <<< "$row"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                calculate_duration "$start" "$end"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="$jitsi_component\t$duration\t$conference_id\t$conference_name\t$participants\t$name_count\t$conference_host\n"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 07:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # output
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            echo -e "$output" | column -t -s $'\t'
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        else
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo -n "No conferences found"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    echo -n " for the time period \"$from_time - $until_time\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo "."
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 11:52:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        exit 0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								elif [[ "$participant_option" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    # the argument to "--participant" can be endpointID, conferenceID, conference name, startsID, IP address
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # check for participants match within a time period (or all if period not given)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # we check for all ot them and show the matches
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## FIXME - we don't catch the case with no results found at all, no message is displayed if no results ## FIXME
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if [[ -n "$participant_arg" ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        db_participants_endpoint=$(printf "$db_conference_by_participant_id_template" "$participant_arg" "$from_time" "$until_time" "$participant_arg" "$from_time" "$until_time")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mapfile -t participants_endpoint < <(db_query "$db_participants_endpoint")
							 
						 
					
						
							
								
									
										
										
										
											2024-06-13 18:09:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        db_participants_conference=$(printf "$db_participant_by_conference_id_template" "$participant_arg" "$from_time" "$until_time" "$participant_arg" "$from_time" "$until_time")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mapfile -t participants_conference < <(db_query "$db_participants_conference")
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        db_participants_conference_name=$(printf "$db_participant_by_conference_name_template" "$participant_arg" "$from_time" "$until_time" "$participant_arg" "$from_time" "$until_time")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mapfile -t participants_conference_name < <(db_query "$db_participants_conference_name")
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        db_participants_statsid=$(printf "$db_participant_by_stats_id_template" "$participant_arg" "$from_time" "$until_time" "$participant_arg" "$from_time" "$until_time")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mapfile -t participants_statsid < <(db_query "$db_participants_statsid")
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        db_participants_ip=$(printf "$db_participant_by_ip_template" "$participant_arg" "$from_time" "$until_time" "$participant_arg" "$from_time" "$until_time")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mapfile -t participants_ip < <(db_query "$db_participants_ip")
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        # match for participant endpoint_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if [[ "${#participants_endpoint[@]}" -gt 0 ]]; then
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            output=""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # prepare the header
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header="\nParticipants with ID matching \"$IMPORTANT_TEXT$participant_arg$NORMAL_TEXT\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    header+=" for the time period \"$from_time - $until_time\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header+="\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo -e "$header"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                output="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the formatted rows
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            for row in "${participants_endpoint[@]}"; do
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="$time\t$conference_id\t$conference_name\t$conference_host\t$loglevel\t$IMPORTANT_TEXT$participant_id$NORMAL_TEXT\t$event_type\t$event_param\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # output
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            echo -e "$output" | column -t -s $'\t'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        # match for conference_id the participant was in
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if [[ "${#participants_conference[@]}" -gt 0 ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            output=""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # prepare the header
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header="\nParticipants in conferences with ID matching \"$IMPORTANT_TEXT$participant_arg$NORMAL_TEXT\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    header+=" for the time period \"$from_time - $until_time\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header+="\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo -e "$header"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the formatted rows
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            for row in "${participants_conference[@]}"; do
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="$time\t$IMPORTANT_TEXT$conference_id$NORMAL_TEXT\t$conference_name\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$event_param\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # output
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            echo -e "$output" | column -t -s $'\t'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        # match for conference_name the participant was in
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if [[ "${#participants_conference_name[@]}" -gt 0 ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            output=""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # prepare the header
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header="\nParticipants in conferences with name that include the string \"$IMPORTANT_TEXT$participant_arg$NORMAL_TEXT\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    header+=" for the time period \"$from_time - $until_time\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header+="\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo -e "$header"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the formatted rows
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            for row in "${participants_conference_name[@]}"; do
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="$time\t$conference_id\t$IMPORTANT_TEXT$conference_name$NORMAL_TEXT\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$event_param\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # output
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            echo -e "$output" | column -t -s $'\t'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        # match for participant stats_id
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if [[ "${#participants_statsid[@]}" -gt 0 ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            output=""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # prepare the header
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header="\nParticipants with stats ID that include the string \"$IMPORTANT_TEXT$participant_arg$NORMAL_TEXT\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    header+=" for the time period \"$from_time - $until_time\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header+="\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo -e "$header"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # prepare the formatted rows
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            for row in "${participants_statsid[@]}"; do
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="$time\t$conference_id\t$conference_name\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$IMPORTANT_TEXT$event_param$NORMAL_TEXT\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # output
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            echo -e "$output" | column -t -s $'\t'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        # match for participant IP
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if [[ "${#participants_ip[@]}" -gt 0 ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            output=""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # prepare the header
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header="\nParticipants with IP address matching \"$IMPORTANT_TEXT$participant_arg$NORMAL_TEXT\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    header+=" for the time period \"$from_time - $until_time\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header+="\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo -e "$header"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the formatted rows
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            for row in "${participants_ip[@]}"; do
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="$time\t$conference_id\t$conference_name\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$IMPORTANT_TEXT$event_param$NORMAL_TEXT\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # output
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            echo -e "$output" | column -t -s $'\t'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        exit 0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        # if no argument is given, we show all the participants
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        db_participants_all=$(printf "$db_participants_all_template" "$from_time" "$until_time")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mapfile -t participant_array < <(db_query "$db_participants_all")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        # we only format the outrput if there are conferences to show
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if [[ "${#participant_array[@]}" -gt 0 ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            output=""
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the header
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header="\nAll participants"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    header+=" for the time period \"$IMPORTANT_TEXT$from_time - $until_time$NORMAL_TEXT\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header+="\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo -e "$header"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="component\tparticipant ID\tconference ID\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 09:49:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the formatted rows
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            for row in "${participant_array[@]}"; do
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                IFS='|' read -r jitsi_component endpoint_id conference_id <<< "$row"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output+="$jitsi_component\t$endpoint_id\t$conference_id\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # output
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            echo -e "$output" | column -t -s $'\t'
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        else
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo -n "No participants found"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    echo -n " for the time period \"$from_time - $until_time\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo "."
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 12:25:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        exit 0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								elif [[ "$time_option" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        db_events_time=$(printf "$db_events_by_period_template" "$from_time" "$until_time" "$from_time" "$until_time")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mapfile -t events_array < <(db_query "$db_events_time")
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if [[ "${#events_array[@]}" -gt 0 ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            output=""
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 12:08:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the header
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                header="\nEvents in the period \"$IMPORTANT_TEXT$from_time - $until_time$NORMAL_TEXT\"\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                output="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo -e "$header"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 12:08:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            # prepare the formatted rows
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            for row in "${events_array[@]}"; do
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                output+="$IMPORTANT_TEXT$time$NORMAL_TEXT\t$conference_id\t$conference_name\t$conference_host\t$loglevel\t$event_type\t$participant_id\t$event_param\n"
							 
						 
					
						
							
								
									
										
										
										
											2024-06-12 12:08:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            # output
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            echo -e "$output" | column -t -s $'\t'
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        else
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if [[ "$silent" != true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo -n "No events found"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if [[ "$time_range_specified" == true ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    echo -n " for the time period \"$from_time - $until_time\""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                echo "."
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:43:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        exit 0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    fi
							 
						 
					
						
							
								
									
										
										
										
											2024-06-02 14:29:12 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 12:29:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								fi