Friday, November 16, 2012

Analyse log files in the pseudo-standard NCSA format

Quick awk script to analyse log files in the pseudo-standard NCSA format to show the number of times each page is hit and what HTTP Status Code is returned for each of the pages
awk '{
splitter=index($7,"=")-1;
if (splitter==-1)
  splitter=length($7);
url=substr($7,1,splitter) "\t" $9;
urls[url]++;
}
END {
for (url in urls)
  print url,"\t",urls[url];
}'

Monday, January 9, 2012

Creating a self-signed certificate using Oracle orapki

In our development environment, when configuring HTTPS for the Oracle XML DB Protocol Server I had to generate a self-signed certificate. All the examples I had seen relied on the owm utility which is only useful in Windows or a X11 environment. To generate a self-signed certificate from the command line execute the following commands:

# Create a new wallet in $ORACLE_BASE/oradata/DEV/wallets/
orapki wallet create -wallet $ORACLE_BASE/oradata/DEV/wallets/ -pwd oracle01 -auto_login

# Add the self-signed certificate to the new wallet
orapki wallet add -wallet $ORACLE_BASE/oradata/DEV/wallets/ -dn "CN=,OU=,O=My Organsisation,L=London,ST=Greater London,C=GB" \
-keysize 1024 -self_signed -validity -pwd oracle01