summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorEric Leblond <eric@regit.org>2012-08-01 11:27:13 +0000
committerPablo Neira Ayuso <pablo@netfilter.org>2012-08-03 11:24:58 +0200
commitd9377e7ba22ec13a0c73785f86e5bcc869d1051f (patch)
tree5858b655b566fd1bd5dcf6a09190d11d2ed7c378 /doc
parent3f4b3658f2323af1e4335186985e6608b49ac9ef (diff)
pgsql schema: add nfacct table
This patch adds a nfacct table to the postgresql schema. It enables the storage of all counters at each poll. Signed-off-by: Eric Leblond <eric@regit.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/pgsql-ulogd2.sql22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/pgsql-ulogd2.sql b/doc/pgsql-ulogd2.sql
index 8f47bf9..0fc2b45 100644
--- a/doc/pgsql-ulogd2.sql
+++ b/doc/pgsql-ulogd2.sql
@@ -33,6 +33,7 @@ DROP TABLE IF EXISTS sctp CASCADE;
DROP TABLE IF EXISTS icmp CASCADE;
DROP TABLE IF EXISTS icmpv6 CASCADE;
DROP TABLE IF EXISTS nufw CASCADE;
+DROP TABLE IF EXISTS nfacct CASCADE;
DROP TABLE IF EXISTS ulog2_ct CASCADE;
DROP TABLE IF EXISTS ulog2 CASCADE;
@@ -149,6 +150,16 @@ CREATE TABLE icmpv6 (
icmpv6_csum integer default NULL
) WITH (OIDS=FALSE);
+CREATE TABLE nfacct (
+ sum_name varchar(128),
+ sum_pkts integer default 0,
+ sum_bytes integer default 0,
+ oob_time_sec integer default NULL,
+ oob_time_usec integer default NULL
+) WITH (OIDS=FALSE);
+
+CREATE UNIQUE INDEX unique_acct ON nfacct(sum_name, oob_time_sec, oob_time_usec);
+
--
-- VIEWS
--
@@ -696,6 +707,17 @@ END
$$ LANGUAGE plpgsql SECURITY INVOKER;
+CREATE OR REPLACE FUNCTION INSERT_NFACCT(
+ IN sum_name varchar(128),
+ IN sum_pkts integer,
+ IN sum_bytes integer,
+ IN oob_time_sec integer,
+ IN oob_time_usec integer
+ )
+RETURNS void AS $$
+ INSERT INTO nfacct (sum_name,sum_pkts,sum_bytes,oob_time_sec,oob_time_usec)
+ VALUES ($1,$2,$3,$4,$5);
+$$ LANGUAGE SQL SECURITY INVOKER;
CREATE OR REPLACE FUNCTION DELETE_PACKET(