pistolero :thispersondoesnotexist: (p@freespeechextremist.com)'s status on Thursday, 07-Dec-2023 12:23:43 JST
-
Embed this notice
@lanodan
> Image finally loaded here,
I tried to work around something by tweaking the code, but I introduced a bug. I blamed the flood instead of properly diagnosing. It's a harsh toke. It's a rough scene.
> your log format
Oh, yeah, that's all just tab-separated with extras; easy to log arbitrary headers with nginx, difficult to trace a path through the network of tunnels that the config file grows. The impromptu histogram grew out of a one-liner; you can probably guess which pieces arrived first just by the indentation.
The 402s never make it to Pleroma, but the disposition of the body of a request that couldn't be understood by Pleroma would probably be extremely useful to have in the logs.
n="$1"; if [ -z "$1" ]; then n=10000; fi
tail -n $n -f /var/log/nginx/access.log | mawk -Winteractive -F"\t" '
$3!=d && $3!=pd{pd=d;d=$3;ti+=i;tj+=j;
if(j!=0)printf("%c[00;31m", 27);
printf("[%d] %d %d/%d %0.02f%% @ %0.01fr/s\n", i, j, tj, ti, 100*tj/ti, NR/s);i=j=0;s++;
printf("%c[00m%s ", 27, substr($3,13,8))}
$4 !~ /^"GET \/(media|emoji|static)\// || $11 != "-" {
if($5>499)printf("%c[01;31m", 27)
else if($5 == 429 || $5 == 499)printf("%c[01;36m", 27)
else if($5 > 399)printf("%c[00;36m", 27)
else if($5 > 299)printf("%c[00;33m", 27)
o=substr($5, 1, 1);
if($5 ~ /^2/) {o="-"; if($4 ~ /"POST /) o = sprintf("%c[01;34m-", 27)}
printf("%s%c[00m", o,27);i++;j+=$5>499}'