Thread: Install pgAudit extension

Install pgAudit extension

From
Dylan Luong
Date:

Hi

 

I need some advice on installing the pgAudit extension as I am new to PostgreSQL extenstions.

 

I currently have Postgres95 on Linux Redhat 6.8 running on the server and I need to test out the pgAudt extension.

I downloaded the file pgaudit-REL9_5_STABLE.zip from https://github.com/pgaudit/pgaudit/tree/REL9_5_STABLE

In the Readme file, under “Compile and Install” the instructions are:

 

1.       Clone the PostgreSQL repository:

git clone https://github.com/postgres/postgres.git

2.       Checkout REL9_5_STABLE branch:

git checkout REL9_5_STABLE

3.       Make PostgreSQL:

./configure

make install -s

4.       Change to the contrib directory:

cd contrib

5.       Clone the pgAudit extension:

git clone https://github.com/pgaudit/pgaudit.git

6.       Change to pgAudit directory:

cd pgaudit

7.       Build pgAudit and run regression tests:

make -s check

8.       Install pgAudit:

make install

 

My problem is that I can’t find the contrib directory anywhere on the server. ( assume this is because the install steps refers to the old Postfres 8???)

There is default directory for extensions in my current 9.5 install:

/usr/pgsql-9.5/share/extension/

 

As I have Postrgres9.5 installed and downloaded the zip file (pgaudit-REL9_5_STABLE.zip), I assume I only have to perform steps 7 and 8.

Do I just unzip the content into a directory /usr/pgsql-9.5/share/extension/pgaudit and then run the steps 7 and 8??? Or do I even need to run the make steps as all the files appears to be there. Ie .control, .sql, .conf, etc.

 

The makefile in pgaudit-REL9_5_STABLE.zip refers to …/contrib/pgaudit/….. ?????

 

# contrib/pg_audit/Makefile

 

MODULE_big = pgaudit

OBJS = pgaudit.o $(WIN32RES)

 

EXTENSION = pgaudit

DATA = pgaudit--1.0.sql

PGFILEDESC = "pgAudit - An audit logging extension for PostgreSQL"

 

REGRESS = pgaudit

REGRESS_OPTS = --temp-config=$(top_srcdir)/contrib/pgaudit/pgaudit.conf

 

ifdef USE_PGXS

PG_CONFIG = pg_config

PGXS := $(shell $(PG_CONFIG) --pgxs)

include $(PGXS)

else

subdir = contrib/pgaudit

top_builddir = ../..

include $(top_builddir)/src/Makefile.global

include $(top_srcdir)/contrib/contrib-global.mk

endif

 

Thanks for your help.

Regards

Dylan

Re: Install pgAudit extension

From
John R Pierce
Date:
On 12/5/2016 9:44 PM, Dylan Luong wrote:
As I have Postrgres9.5 installed and downloaded the zip file (pgaudit-REL9_5_STABLE.zip), I assume I only have to perform steps 7 and 8.

if you installed postgres from the yum.postgresql.org repository, try...


    yum install pgaudit_95

https://yum.postgresql.org/9.5/redhat/rhel-6-x86_64/repoview/pgaudit_95.html


-- 
john r pierce, recycling bits in santa cruz

Re: Install pgAudit extension

From
Devrim Gündüz
Date:
Hi,

On Tue, 2016-12-06 at 05:44 +0000, Dylan Luong wrote:
> I need some advice on installing the pgAudit extension as I am new to
> PostgreSQL extenstions.

Looks like you installed PostgreSQL via community RPMS, so:

https://yum.postgresql.org/9.5/redhat/rhel-6-x86_64/pgaudit_95-1.0.4-1.rhel6.x8
6_64.rpm

it means, 

yum install pgaudit_95

will do the trick for installing. Then you can create the extension with:

CREATE EXTENSION pgaudit;

You will need to add some lines to postgresql.conf. Sample ones are here:

https://github.com/devrimgunduz/pgextensionconfig/blob/master/9.5/pgaudit.conf

-HTH

Regards,
--
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

Attachment

Re: Install pgAudit extension

From
Artur Zakirov
Date:
On 06.12.2016 08:44, Dylan Luong wrote:
> Hi
>
>
>
> I need some advice on installing the pgAudit extension as I am new to
> PostgreSQL extenstions.
>

You can use PGXS. With PGXS you don't need postgres's source code, only
source code of pgaudit. But you need installed PostgreSQL. Here is the
example:

1 - unzip pgaudit to a pgaudit directory
2 - go to a pgaudit directory:

cd pgaudit

3 - compile and install:

make USE_PGXS=1
make USE_PGXS=1 install

It is assumed that pg_config is in your $PATH variable. If it is not
then you can run:

make USE_PGXS=1 PG_CONFIG=<path_to_postgres_bin>/pg_config
make USE_PGXS=1 PG_CONFIG=<path_to_postgres_bin>/pg_config install

--
Artur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company


Re: [GENERAL] Install pgAudit extension

From
Dylan Luong
Date:
Hi 

Thanks for your reply. I have managed to get pgAudit install and I believe is working as I can see audit logs in my log
files.
I like to now install the PostgreSQL Audit Log Analyzer. Is there a similar rpm for the PostgreSQL Audit Log Analyser?

Regards
Dylan

-----Original Message-----
From: Devrim Gündüz [mailto:devrim@gunduz.org] 
Sent: Tuesday, 6 December 2016 5:44 PM
To: Dylan Luong <Dylan.Luong@unisa.edu.au>; pgsql-general@postgresql.org
Subject: Re: [GENERAL] Install pgAudit extension


Hi,

On Tue, 2016-12-06 at 05:44 +0000, Dylan Luong wrote:
> I need some advice on installing the pgAudit extension as I am new to 
> PostgreSQL extenstions.

Looks like you installed PostgreSQL via community RPMS, so:

https://yum.postgresql.org/9.5/redhat/rhel-6-x86_64/pgaudit_95-1.0.4-1.rhel6.x8
6_64.rpm

it means, 

yum install pgaudit_95

will do the trick for installing. Then you can create the extension with:

CREATE EXTENSION pgaudit;

You will need to add some lines to postgresql.conf. Sample ones are here:

https://github.com/devrimgunduz/pgextensionconfig/blob/master/9.5/pgaudit.conf

-HTH

Regards,
--
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR