2025-11-25

This commit is contained in:
2025-11-25 21:37:46 -05:00
parent 78b0203064
commit acbe4f639c
23 changed files with 4592 additions and 14 deletions

View File

@@ -0,0 +1,35 @@
```SQL
WITH DrainingConnectionIds AS (
SELECT DISTINCT
connectionId
FROM
`phenix-pcast.pcast_logs_us.syslog`,
UNNEST(REGEXP_EXTRACT_ALL(Message, r"'([^']+)'")) AS connectionId
WHERE
Timestamp >= TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL -2 MINUTE)
AND Message LIKE "%Websocket connectionids preventing drain%"
),
SessionStartLogs AS (
SELECT
REGEXP_EXTRACT(Message, r"\[([^\]]+)\]") AS ApplicationId,
REGEXP_EXTRACT(Message, r"connection \[([^\]]+)\]") AS ConnectionId,
Message
FROM
`phenix-pcast.pcast_logs_us.syslog`
WHERE
Timestamp >= TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL -90 DAY)
AND Message LIKE '%Session started with connection%'
)
SELECT
s.ApplicationId,
s.ConnectionId,
REGEXP_EXTRACT_ALL(s.Message, r"connection \[(\]]+)\]")[SAFE_OFFSET(1)] AS SessionId
FROM
SessionStartLogs AS s
INNER JOIN
DrainingConnectionIds AS d
ON
s.ConnectionId = d.connectionId
```