diff --git a/apier/v1/apier_it_test.go b/apier/v1/apier_it_test.go
index d572014a5..630954d5b 100644
--- a/apier/v1/apier_it_test.go
+++ b/apier/v1/apier_it_test.go
@@ -73,81 +73,81 @@ var (
testApierInitStorDb,
testApierStartEngine,
testApierRpcConn,
- // testApierTPTiming,
- // testApierTPDestination,
- // testApierTPRate,
- // testApierTPDestinationRate,
- // testApierTPRatingPlan,
- // testApierTPRatingProfile,
- // testApierTPActions,
- // testApierTPActionPlan,
- // testApierTPActionTriggers,
- // testApierTPAccountActions,
- // testApierLoadRatingPlan,
- // testApierLoadRatingProfile,
- // testApierLoadRatingProfileWithoutTenant,
- // testApierLoadAccountActions,
- // testApierReloadScheduler,
- // testApierSetRatingProfile,
- // testApierSetRatingProfileWithoutTenant,
- // testApierRemoveRatingProfilesWithoutTenant,
- // testAPIerSv1GetRatingProfile,
- // testAPIerSv1GetRatingProfileWithoutTenant,
- // testAPIerSv1GetRatingProfileIDsWithoutTenant,
- // testApierReloadCache,
- // testApierGetActionTrigger,
- // testApierGetDestination,
- // testApierGetRatingPlan,
- // testApierRemoveRatingPlan,
- // testApierAddBalance,
- // testApierExecuteAction,
- // testApierExecuteActionWithoutTenant,
- // testApierSetActions,
- // testApierGetActions,
- // testApierSetActionPlan,
- // testApierAddTriggeredAction,
- // testApierGetAccountActionTriggers,
- // testApierAddTriggeredAction2,
- // testApierGetAccountActionTriggers2,
- // testApierSetAccountActionTriggers,
- // testApierRemAccountActionTriggers,
- // testApierSetAccount,
- // testApierGetAccountActionPlan,
- // testApierGetAccountActionPlanWithoutTenant,
- // testApierITGetScheduledActionsForAccount,
- // testApierRemUniqueIDActionTiming,
- // testApierRemUniqueIDActionTimingWithoutTenant,
- // testApierGetAccount,
- // testApierTriggersExecute,
- // testApierResetDataBeforeLoadFromFolder,
- // testApierLoadTariffPlanFromFolder,
- // testApierComputeReverse,
- // testApierResetDataAfterLoadFromFolder,
- // testApierSetChargerS,
- // testApierGetAccountAfterLoad,
- // testApierResponderGetCost,
- // testApierMaxDebitInexistentAcnt,
- // testApierCdrServer,
- // testApierITGetCdrs,
- // testApierITProcessCdr,
- // testApierGetCallCostLog,
- // testApierITSetDestination,
- // testApierITGetScheduledActions,
- // testApierITGetDataCost,
- // testApierITGetCost,
+ testApierTPTiming,
+ testApierTPDestination,
+ testApierTPRate,
+ testApierTPDestinationRate,
+ testApierTPRatingPlan,
+ testApierTPRatingProfile,
+ testApierTPActions,
+ testApierTPActionPlan,
+ testApierTPActionTriggers,
+ testApierTPAccountActions,
+ testApierLoadRatingPlan,
+ testApierLoadRatingProfile,
+ testApierLoadRatingProfileWithoutTenant,
+ testApierLoadAccountActions,
+ testApierReloadScheduler,
+ testApierSetRatingProfile,
+ testApierSetRatingProfileWithoutTenant,
+ testApierRemoveRatingProfilesWithoutTenant,
+ testAPIerSv1GetRatingProfile,
+ testAPIerSv1GetRatingProfileWithoutTenant,
+ testAPIerSv1GetRatingProfileIDsWithoutTenant,
+ testApierReloadCache,
+ testApierGetActionTrigger,
+ testApierGetDestination,
+ testApierGetRatingPlan,
+ testApierRemoveRatingPlan,
+ testApierAddBalance,
+ testApierExecuteAction,
+ testApierExecuteActionWithoutTenant,
+ testApierSetActions,
+ testApierGetActions,
+ testApierSetActionPlan,
+ testApierAddTriggeredAction,
+ testApierGetAccountActionTriggers,
+ testApierAddTriggeredAction2,
+ testApierGetAccountActionTriggers2,
+ testApierSetAccountActionTriggers,
+ testApierRemAccountActionTriggers,
+ testApierSetAccount,
+ testApierGetAccountActionPlan,
+ testApierGetAccountActionPlanWithoutTenant,
+ testApierITGetScheduledActionsForAccount,
+ testApierRemUniqueIDActionTiming,
+ testApierRemUniqueIDActionTimingWithoutTenant,
+ testApierGetAccount,
+ testApierTriggersExecute,
+ testApierResetDataBeforeLoadFromFolder,
+ testApierLoadTariffPlanFromFolder,
+ testApierComputeReverse,
+ testApierResetDataAfterLoadFromFolder,
+ testApierSetChargerS,
+ testApierGetAccountAfterLoad,
+ testApierResponderGetCost,
+ testApierMaxDebitInexistentAcnt,
+ testApierCdrServer,
+ testApierITGetCdrs,
+ testApierITProcessCdr,
+ testApierGetCallCostLog,
+ testApierITSetDestination,
+ testApierITGetScheduledActions,
+ testApierITGetDataCost,
+ testApierITGetCost,
testApierInitDataDb2,
testApierInitStorDb2,
- // testApierReloadCache2,
- // testApierReloadScheduler2,
- // testApierImportTPFromFolderPath,
- // testApierLoadTariffPlanFromStorDbDryRun,
- // testApierGetCacheStats2,
- // testApierLoadTariffPlanFromStorDb,
- // testApierStartStopServiceStatus,
+ testApierReloadCache2,
+ testApierReloadScheduler2,
+ testApierImportTPFromFolderPath,
+ testApierLoadTariffPlanFromStorDbDryRun,
+ testApierGetCacheStats2,
+ testApierLoadTariffPlanFromStorDb,
+ testApierStartStopServiceStatus,
testApierReplayFldPosts,
- // testApierGetDataDBVesions,
- // testApierGetStorDBVesions,
- // testApierBackwardsCompatible,
+ testApierGetDataDBVesions,
+ testApierGetStorDBVesions,
+ testApierBackwardsCompatible,
testApierStopEngine,
//start test for cache options
diff --git a/apier/v1/triggers.go b/apier/v1/triggers.go
index b86f9a434..5dc2bacd8 100644
--- a/apier/v1/triggers.go
+++ b/apier/v1/triggers.go
@@ -339,7 +339,7 @@ func (attr *AttrSetActionTrigger) UpdateActionTrigger(at *engine.ActionTrigger,
}
if minQ, has := attr.ActionTrigger[utils.MinQueuedItems]; has {
var mQ int64
- if mQ, err = utils.IfaceAsInt64(minQ); err != nil {
+ if mQ, err = utils.IfaceAsTInt64(minQ); err != nil {
return
}
at.MinQueuedItems = int(mQ)
diff --git a/config/config.go b/config/config.go
index d8469b78b..037bb5836 100644
--- a/config/config.go
+++ b/config/config.go
@@ -325,7 +325,8 @@ var possibleReaderTypes = utils.NewStringSet([]string{utils.MetaFileCSV,
var possibleExporterTypes = utils.NewStringSet([]string{utils.MetaFileCSV, utils.MetaNone, utils.MetaFileFWV,
utils.MetaHTTPPost, utils.MetaHTTPjsonMap, utils.MetaAMQPjsonMap, utils.MetaAMQPV1jsonMap, utils.MetaSQSjsonMap,
- utils.MetaKafkajsonMap, utils.MetaS3jsonMap, utils.MetaElastic, utils.MetaVirt, utils.MetaSQL, utils.MetaNatsjsonMap})
+ utils.MetaKafkajsonMap, utils.MetaS3jsonMap, utils.MetaElastic, utils.MetaVirt, utils.MetaSQL, utils.MetaNatsjsonMap,
+ utils.MetaLog})
// LazySanityCheck used after check config sanity to display warnings related to the config
func (cfg *CGRConfig) LazySanityCheck() {
diff --git a/ees/ee.go b/ees/ee.go
index ae08f4e47..175c917cf 100644
--- a/ees/ee.go
+++ b/ees/ee.go
@@ -70,11 +70,13 @@ func NewEventExporter(cfg *config.EventExporterCfg, cgrCfg *config.CGRConfig, fi
case utils.MetaKafkajsonMap:
return NewKafkaEE(cfg, dc), nil
case utils.MetaVirt:
- return NewVirtualEE(cfg, dc)
+ return NewVirtualEE(cfg, dc), nil
case utils.MetaElastic:
return NewElasticEE(cfg, dc)
case utils.MetaSQL:
return NewSQLEe(cfg, dc)
+ case utils.MetaLog:
+ return NewLogEE(cfg, dc), nil
default:
return nil, fmt.Errorf("unsupported exporter type: <%s>", cfg.Type)
}
diff --git a/ees/ee_test.go b/ees/ee_test.go
index 4be09996d..a51f04b5e 100644
--- a/ees/ee_test.go
+++ b/ees/ee_test.go
@@ -157,10 +157,7 @@ func TestNewEventExporterCase6(t *testing.T) {
if err != nil {
t.Error(err)
}
- eeExpect, err := NewVirtualEE(cgrCfg.EEsCfg().Exporters[0], dc)
- if err != nil {
- t.Error(err)
- }
+ eeExpect := NewVirtualEE(cgrCfg.EEsCfg().Exporters[0], dc)
newEE := ee.(*VirtualEE)
newEE.dc.MapStorage[utils.TimeNow] = nil
eeExpect.dc.MapStorage[utils.TimeNow] = nil
diff --git a/ees/log.go b/ees/log.go
new file mode 100644
index 000000000..af276ee19
--- /dev/null
+++ b/ees/log.go
@@ -0,0 +1,64 @@
+/*
+Real-time Online/Offline Charging System (OerS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package ees
+
+import (
+ "fmt"
+ "strings"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func NewLogEE(cfg *config.EventExporterCfg, dc *utils.SafeMapStorage) *LogEE {
+ return &LogEE{
+ cfg: cfg,
+ dc: dc,
+ }
+}
+
+// LogEE implements EventExporter interface for .csv files
+type LogEE struct {
+ cfg *config.EventExporterCfg
+ dc *utils.SafeMapStorage
+}
+
+func (vEe *LogEE) Cfg() *config.EventExporterCfg { return vEe.cfg }
+func (vEe *LogEE) Connect() error { return nil }
+func (vEe *LogEE) ExportEvent(mp interface{}, _ string) error {
+ utils.Logger.Info(
+ fmt.Sprintf("<%s> <%s> exported: <%s>",
+ utils.EEs, vEe.Cfg().ID, utils.ToJSON(mp)))
+ return nil
+}
+func (vEe *LogEE) Close() error { return nil }
+func (vEe *LogEE) GetMetrics() *utils.SafeMapStorage { return vEe.dc }
+func (vEe *LogEE) PrepareMap(mp map[string]interface{}) (interface{}, error) {
+ return mp, nil
+}
+func (vEe *LogEE) PrepareOrderMap(mp *utils.OrderedNavigableMap) (interface{}, error) {
+ valMp := make(map[string]interface{})
+ for el := mp.GetFirstElement(); el != nil; el = el.Next() {
+ path := el.Value
+ nmIt, _ := mp.Field(path)
+ path = path[:len(path)-1] // remove the last index
+ valMp[strings.Join(path, utils.NestingSep)] = nmIt.String()
+ }
+ return valMp, nil
+}
diff --git a/ees/virtualee.go b/ees/virtualee.go
index 6260d7ecc..5852b560a 100644
--- a/ees/virtualee.go
+++ b/ees/virtualee.go
@@ -23,12 +23,11 @@ import (
"github.com/cgrates/cgrates/utils"
)
-func NewVirtualEE(cfg *config.EventExporterCfg, dc *utils.SafeMapStorage) (vEe *VirtualEE, err error) {
- vEe = &VirtualEE{
+func NewVirtualEE(cfg *config.EventExporterCfg, dc *utils.SafeMapStorage) *VirtualEE {
+ return &VirtualEE{
cfg: cfg,
dc: dc,
}
- return
}
// VirtualEE implements EventExporter interface for .csv files
diff --git a/packages/debian/changelog b/packages/debian/changelog
index b0cf25425..e1e877b65 100644
--- a/packages/debian/changelog
+++ b/packages/debian/changelog
@@ -170,6 +170,7 @@ cgrates (0.11.0~dev) UNRELEASED; urgency=medium
* [EEs] Added *nats_json_map
* [RSRParsers] Added *slice dataconverter
* [CacheS] Updated LoadCache and ReloadCache APIs
+ * [EEs] Added *log exporter
-- DanB Wed, 19 Feb 2020 13:25:52 +0200