Apache can log specific cookies like the session id. Below is an example of such configuration for the typical JEE application:
LogFormat "%h %l %u %t \"%r\" %>s %b %{JSESSIONID}C" custom CustomLog /var/log/apache2/sample.com.log custom
LogFormat "%h %l %u %t \"%r\" %>s %b %{JSESSIONID}C" custom CustomLog /var/log/apache2/sample.com.log custom
192.168.0.100 - - [22/Sep/2013:06:25:09 -0400] "POST /my/resource HTTP/1.1" 200 3664When the below command is run:
grep -o "[^\?]*" access.log | sed 's/[0-9]*//g' | awk '{url[$7]++} END{for (i in url) {print url[i], i}}' | sort -nrThen an output like the below will be returned:
10000 /my/top/hit/resource ... 50 /my/number//including/hit/resource ... 1 /my/bottom/hit/resourceThe command first gets rid of the query string, replaces all numbers (This allows us not to consider resources that differ by ids as different), builds an associative array (or map) with key being the resource and content being the number of such resources found, prints it as "counter resource" and finally sorts it descendant (no real need for the -n switch as no numbers will be present in the URL.
ssh -o PubkeyAuthentication=no user@my.domain.com
$ mycommand.sh & sleep $delay & cpulimit -e gzip -l 30 -zLooking at the man pages you will realize we are limitting overall usage to 30% of the whole available CPU (if 3 processors then around 10% each) and the -z option will make cpulimit to quit if no gzip process is found, hence the delay for the command will depend on what that command actually does.
$ stress --vm 1 --vm-bytes 500M -t 30s --vm-hang 30 stress: info: [7651] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hddTest up front, Quality assurance is the very first step to guarantee constant process improvement.
#!/bin/bash -e #/usr/sbin/fixInvalidFileName.sh USAGE="Usage: `basename $0` <filePath>" if [ $# -ne "1" ] then echo $USAGE exit 1 fi file=$1 pattern=$'[\r\n]' if [[ "$file" == *$pattern* ]]; then mv "$file" "${file//$pattern/}" fiNow you can use it like:
find . -name "*" -exec /usr/sbin/fixInvalidFileName.sh {} \;And the result would be newlines stripped out the file name.
Nestor Urquiza is a hands-on technologist, security-first thinker and results-oriented business executive. An Electronics Engineer dealing with hardware, embedded/web software development, security, compliance and full business funnel process engineering. Keeping things simple and innovating top-down, from Marketing to Accounting.