Friday, 11 December 2015

Mask access_log.txt

Requirement is to extract access_log.txt in specific format, you can alter the text based on your requirement by additing extra $<position of word you are interested in>

Following command can be placed inside the file for example fal.sh

searchInFile=$(date "--date=${dataset_date} -1 day" +%d"/"%b"/"%Y|tr '[:lower:]' '[:upper:]')

createFile=$(date '+%d-%b-%Y')
 

grep ${searchInFile} access_log.txt|awk '{print $1,$6,$7}'|awk '{print "XXX.XXX.XXX",$2,$3}'>$createFile

grant execute priv on fal.sh, chmod +x fal.sh


Monday, 22 June 2015

Operational Document for postgreSQL


Environment file of postgreSQL

pg_env.sh, it has all the environment setting for postgres



Where to check Information of running process.



postmaster.pid file - its the file containing process id of postmaster process.

Process with id 7672(below screenshot) contains information of postgres postmaster process






Logfile location of postgresql

It depends on installation directory, to get the location open file pg_env.sh.
File pg_env.sh is created by installer in the base directory of postgres installation, refer variable PGDATA, then log file shall be created under $PGDATA/pg_log

In my case its created under /u01/app/postgres/data/pg_log





Start postgres

If the services are configured to start when box is rebooted then its not required, incase it requires starting manually, then following can be used.
There are two ways to start postgres, and I am restricting only two standard way of starting it with bare basic arguments.

pg_ctl start
postgres - if postgres must know where to find the data it is supposed to use or else
postgres -D /u01/app/postgres/data but it executes in foreground


Start pgAdminIII from command prompt.

Variable LD_LIBRARY_PATH is required to setup to pick required libraries.


LD_LIBRARY_PATH=/u01/app/postgres/pgAdmin3/lib:/u01/app/postgres/lib:$LD_LIBRARY_PATH

export LD_LIBRARY_PATH

/u01/app/postgres/pgAdmin3/bin/pgadmin3

Note: pgAdminIII is installed in /u01/app/postgres and it can be different, depending on setup.