Skip to content

Instantly share code, notes, and snippets.

@mark-stopka
Last active March 4, 2020 13:37
Show Gist options
  • Save mark-stopka/98083f23fd6c80096f11354576086ace to your computer and use it in GitHub Desktop.
Save mark-stopka/98083f23fd6c80096f11354576086ace to your computer and use it in GitHub Desktop.
#!/bin/bash
CONTAINER_ID=$1
docker logs ${CONTAINER_ID} >& ../logs/${CONTAINER_ID}.info.log
grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]:[0-9].)" \
../logs/${CONTAINER_ID}.info.log > ../logs/${CONTAINER_ID}.ip-port.log
grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" \
../logs/${CONTAINER_ID}.ip-port.log > ../logs/${CONTAINER_ID}.ip.log
sort -u ../logs/${CONTAINER_ID}.ip-port.log > ../logs/${CONTAINER_ID}.ip-port.unique.log
sort -u ../logs/${CONTAINER_ID}.ip.log > ../logs/${CONTAINER_ID}.ip.unique.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment