Navigation


Changeset 528:1b3b9790e7cb in freeDiameter


Ignore:
Timestamp:
Sep 3, 2010, 4:46:16 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Add a new field in the app_acct.fdx database to receive the name of the local server.

Update your existing tables with the following SQL command:
ALTER TABLE "incoming" ADD "recorded_serv" bytea NOT NULL;

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • doc/app_acct.conf.sample

    r527 r528  
    4545#
    4646# Note that at the moment, GROUPED AVP are not supported. Also, only the top-level AVPs are
    47 # search. This behavior can be changed quite easily if needed.
     47# searched. This behavior can be changed quite easily if needed.
    4848
    4949# The following list is informative only.
     
    108108
    109109# This is the database table corresponding to this list:
    110 # CREATE TABLE app_acct (
     110# CREATE TABLE incoming (
    111111#     "recorded_on" timestamp with time zone NOT NULL,
     112#     "recorded_serv" bytea NOT NULL,
    112113#     "Origin-Host" bytea NOT NULL,
    113114#     "Origin-Realm" bytea NOT NULL,
     
    195196# Optionaly, you can specify a name of a field that will receive the value 'now' when a new record is inserted.
    196197# Default: no timestamp is inserted.
    197 # Example: Timestamp_field = "inc_ts";
    198 
    199 
    200 
    201 
    202 
     198# Example: Timestamp_field = "recorded_on";
     199
     200# Server_name_field:
     201# Optionaly, you can specify a field which will receive the Diameter Identity of the local server for each record saved.
     202# This is useful especially if you have several Accounting servers and want to check Load-Balancing behavior or so,
     203# after aggregating all the data.
     204# Default: no server name inserted.
     205# Example: Server_name_field = "recorded_serv";
     206
     207
     208
  • extensions/app_acct/acct_conf.l

    r284 r528  
    114114                        }
    115115
     116(?i:"Server_name_field") {
     117                                return SRVNFIELD;
     118                        }
     119
    116120(?i:"field")            {
    117121                                return FIELD;
  • extensions/app_acct/acct_conf.y

    r403 r528  
    102102        fd_log_debug("   Table name .... : '%s'\n", acct_config->tablename ?: "<null>");
    103103        fd_log_debug("   Timestamp field : '%s'\n", acct_config->tsfield ?: "<null>");
     104        fd_log_debug("   Server name fld : '%s'\n", acct_config->srvnfield ?: "<null>");
    104105        fd_log_debug(" AVPs that will be saved to the database:\n");
    105106        for (li = acct_config->avps.next; li != &acct_config->avps; li = li->next) {
     
    137138        free(acct_config->tablename);
    138139        free(acct_config->tsfield);
     140        free(acct_config->srvnfield);
    139141       
    140142        /* Done */
     
    205207%token          TABLE
    206208%token          TSFIELD
     209%token          SRVNFIELD
    207210
    208211/* Tokens and types */
     
    224227                        | conffile tableline
    225228                        | conffile tsfieldline
     229                        | conffile srvnfieldline
    226230                        | conffile errors
    227231                        {
     
    321325                        }
    322326                        ;
     327
     328srvnfieldline:          SRVNFIELD '=' QSTRING ';'
     329                        {
     330                                if (acct_config->srvnfield) {
     331                                        yyerror (&yylloc, conffile, "Duplicate entry");
     332                                        YYERROR;
     333                                }
     334                                acct_config->srvnfield = $3
     335                        }
     336                        ;
  • extensions/app_acct/acct_db.c

    r403 r528  
    142142        }
    143143       
     144        if (acct_config->srvnfield) {
     145                ADD_EXTEND("\"");
     146                ADD_ESCAPE(acct_config->srvnfield);
     147                ADD_EXTEND("\", ");
     148        }
     149       
    144150        for (li = emptyrecords.all.next; li != &emptyrecords.all; li = li->next) {
    145151                struct acct_record_item * i = (struct acct_record_item *)(li->o);
     
    158164        if (acct_config->tsfield) {
    159165                ADD_EXTEND("$%d, ", ++idx);
     166        }
     167        if (acct_config->srvnfield) {
     168                ADD_EXTEND("\"");
     169                ADD_ESCAPE(fd_g_config->cnf_diamid);
     170                ADD_EXTEND("\", ");
    160171        }
    161172       
  • extensions/app_acct/app_acct.h

    r285 r528  
    7575        char            *tablename;     /* the name of the table we are working with */
    7676        char            *tsfield;       /* the name of the timestamp field, or NULL if not required */
     77        char            *srvnfield;     /* the name of the server name field, or NULL if not required */
    7778};
    7879
Note: See TracChangeset for help on using the changeset viewer.