Git Product home page Git Product logo

pgauditlogtofile's Introduction

pgAudit Log to File

pgAudit Log to File is an addon to pgAudit than will redirect audit log lines to an independent file, instead of using PostgreSQL server logger.

This will allow us to have an audit file that we can easily rotate without polluting server logs with those messages.

Audit logs in heavily used systems can grow very fast. This extension allows to automatically rotate the files based in a number of minutes.

Build

make install USE_PGXS=1

Installation

  • Build the extension
  • Add pgauditlogtofile to "shared_preload_libraries" in postgresql.conf
  • Restart PostgreSQL to reload new shared library
  • Create extension in postgres database (like pgaudit we don't need to create it in all the databases)
postgres=# CREATE EXTENSION pgauditlogtofile;

Configuration

pgaudit.log_directory

Name of the directory where the audit file will be created.

Scope: System

Default: 'log'

Empty or NULL will disable the extension and the audit logging will be done to PostgreSQL server logger.

pgaudit.log_filename

Name of the file where the audit will be written. Writing to an existing file will append the new entries.

This variable can contain time patterns up to minute to allow automatic rotation.

Scope: System

Default: 'audit-%Y%m%d_%H%M.log'

Empty or NULL will disable the extension and the audit logging will be done to PostgreSQL server logger.

pgaudit.log_rotation_age

Number of minutes after which the audit file will be rotated.

Scope: System

Default: 1440 minutes (1 day)

0 will disable the rotation

pgaudit.log_connections

Intercepts server log messages emited when log_connections is on

Scope: System

Default: off

Requires: log_connections = on

pgaudit.log_disconnections

Intercepts server log messages emited when log_disconnections is on

Scope: System

Default: off

Requires: log_disconnections = on

Test

cd test
vagrant plugin install vagrant-vbguest
vagrant up

pgauditlogtofile's People

Contributors

fmbiete avatar nvthongswansea avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.