Hi Andrey,

To your questions:

1) 01011970 corresponds to a UNIX timestamp of zero. The easiest way to
   mitigate it is to use 'nfacctd_time_new: true' so to consider the
   time of arrival at the collector (that is, nfacctd) as timestamp for
   bucketing instead of the flow start time; alternatively - or also in
   addition - you can look in your flow data in case there are some with
   a flow start time of zero (and if not and you can pin point what gets
   purged to that table, we may be facing a bug or maybe an explanation
   for it ..).  
 
2) It is a simplistic yet harmless approach to blindly send a CREATE
   TABLE, maybe the message back should be made a warning rather than an
   error. It's harmless because as you see, data is purged anyway; it's
   simplistic because it saves the effort to probe if the table exists. 

Paolo

On Tue, Mar 13, 2018 at 04:32:52PM +0200, Andrey Koblyuk wrote:
> Hello!
> 
> my config
> 
> aggregate[storage]                      : 
> src_host,dst_host,src_port,dst_port,proto,src_as,dst_as,in_iface,out_iface,timestamp_start,timestamp_end
> sql_optimize_clauses[storage]           : true
> sql_table[storage]                      : traffic_%d%m%Y
> sql_table_schema[storage]               : /etc/pmacct/nfacct_schema.psql
> sql_table_type[storage]                 : bgp
> sql_dont_try_update[storage]            : true
> sql_use_copy[storage]                   : true
> 
> /etc/pmacct/nfacct_schema.psql:
> CREATE TABLE traffic_%d%m%Y (
>         id_key BIGSERIAL PRIMARY KEY,
>         as_src BIGINT NOT NULL DEFAULT 0,
>         as_dst BIGINT NOT NULL DEFAULT 0,
>         ip_src inet NOT NULL DEFAULT '0.0.0.0',
>         ip_dst inet NOT NULL DEFAULT '0.0.0.0',
>         port_src INT NOT NULL DEFAULT 0,
>         port_dst INT NOT NULL DEFAULT 0,
>         ip_proto SMALLINT NOT NULL DEFAULT 0,
>         iface_in INT NOT NULL,
>         iface_out INT NOT NULL,
>         packets INT NOT NULL,
>         bytes BIGINT NOT NULL,
>         timestamp_start timestamp without time zone NOT NULL DEFAULT 
> '0001-01-01 00:00:00',
>         timestamp_start_residual INT NOT NULL DEFAULT 0,
>         timestamp_end timestamp without time zone NOT NULL DEFAULT 
> '0001-01-01 00:00:00',
>         timestamp_end_residual INT NOT NULL DEFAULT 0,
>         stamp_inserted timestamp without time zone NOT NULL DEFAULT 
> CURRENT_TIMESTAMP(0)
> );
> GRANT SELECT, INSERT, UPDATE, DELETE ON traffic_%d%m%Y TO pmacct;
> 
> 1) first "purge" create table traffic_01011970, but current date 13032018. 
> Why table create on 01011970?
> 2) next "purge" print this error in log
> INFO ( storage/pgsql ): *** Purging cache - START (PID: 11285) ***
> ERROR ( storage/pgsql ): ERROR:  relation "traffic_01011970" already exists
> INFO ( storage/pgsql ): *** Purging cache - END (PID: 11285, QN: 
> 137084/137084, ET: 1) ***
> 
> Why does the table try to be recreated with each purge? what parameter is 
> responsible for this?
> 
> -- 
> ANK32-RIPE
> 
> 
> _______________________________________________
> pmacct-discussion mailing list
> http://www.pmacct.net/#mailinglists

_______________________________________________
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists

Reply via email to