Skip to content

Instantly share code, notes, and snippets.

@hamza-cskn
Created February 2, 2026 12:05
Show Gist options
  • Select an option

  • Save hamza-cskn/60231340d4efc946bd201f447efc96c9 to your computer and use it in GitHub Desktop.

Select an option

Save hamza-cskn/60231340d4efc946bd201f447efc96c9 to your computer and use it in GitHub Desktop.
Docker logs but only important ones. No fuzzy/exact duplicates.
docker logs containername | grep -ie error | sed 's/^[^ ]* //' | awk '!seen[$0]++' | awk '
function sim(a,b, i,c) {
if (length(a)!=length(b)) return 0
c=0
for (i=1;i<=length(a);i++)
if (substr(a,i,1)==substr(b,i,1)) c++
return c/length(a)
}
{
for (i in buf)
if (sim($0, buf[i]) > 0.99) next
print
buf[++n]=$0
if (n>50) delete buf[n-50]
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment