logging in bash

This function will only log an entry when the script is in debug mode. This is a much usefull way then changing a variable inside the script itself: log(){     : ${DEBUG:=0}     : ${LOG_PATH:=/var/log/logfile.log}     [[ $DEBUG == "1" ]] && echo $(date +%Y-%m-%d:%S) $1 >> $LOG_PATH } When you need it inside the script, just add: log "log message"  To run in debug… Continue reading logging in bash


Poor man’s port mirroring in VMware ESXi

Mirroring ports is a method of monitoring network traffic. Basically, the switch sends a copy of the packets to another port. If we connect a listening software, better known as a "sniffer" (tcpdump, wireshark etc.), we can log all packets sent to this port and analyze them. This is quite usefull in testing scenarios. VMware ESXi… Continue reading Poor man’s port mirroring in VMware ESXi