PGLOG CSVLOG Sample Analysis
Built-in applet for PostgreSQL CSV log sample analysis
PGLOG Analysis & PGLOG Session provide introspection about PostgreSQL csvlog sample (via table pglog.sample
on cmdb).
- PGLOG Analysis: Analysis of csvlog sample on CMDB (focusing on entire log sample).
- PGLOG Session: Analysis of csvlog sample (focusing on the single session).
There are some handy alias & func sets on the meta node.
Load csvlog from stdin into sample table.
alias pglog="psql service=meta -AXtwc 'TRUNCATE pglog.sample; COPY pglog.sample FROM STDIN CSV;'" # useful alias
Get log from pgsql node.
# default: get pgsql csvlog (localhost @ today)
function catlog(){ # getlog <ip|host> <date:YYYY-MM-DD>
local node=${1-'127.0.0.1'}
local today=$(date '+%Y-%m-%d')
local ds=${2-${today}}
ssh -t "${node}" "sudo cat /pg/data/log/postgresql-${ds}.csv"
}
Combine theme to fetch and load csvlog sample.
catlog | pglog # get local (metadb) today's log
catlog node-1 '2021-07-15' | pglog # get node-1's csvlog @ 2021-07-15
catlog [node=localhost] [date=today] # Print PG CSV log to stdout
pglog # ingest pgcsv log into sample table
pglog12 # ingest pg 12 log
pglog13 # ingest pg 13 log
pglog14 # ingest pg 14 log (default)
catlog | pglog # pour log of current node
catlog node-1 '2021-07-15' | pglog # analysis node-1 on 2021-07-15j
Last modified 2022-06-18: v1.5.1 (8de4142)