# class # create class if not exists /test_perf_tsdb ( testhost varchar, testvalue bucket { "type": "tsdb", "param": ["pint1","pint2","pfloat1","pfloat2","pstring1","pstring2"], "ptype": ["i","i","f","f","s","s"], "unit": ["ms","ms","%","%","",""], "precision": [0,0,2,3,0,0], "ttl": 1 }, keys(testhost), indexes(testhost) ); insert into /test_perf_tsdb (testhost) values ('test'); # rule # ## path ## /matrix/rules/test/perf/tsdb ## lua rule ## --class = /test_perf_tsdb --parser = csv , --fields = ID,TIME,P1,P2,P3,P4,P5,P6 --mqltmpl = insert into /test_perf_tsdb (id, testvalue) values (?, ?) at ? --mqltmpl_fields = id,testvalue,attime --ignore = false _id = ID _testvalue = {tonumber(P1),tonumber(P2),tonumber(P3),tonumber(P4),P5,P6} _attime = tonumber(TIME) ## direct rule ## --class = /test_perf_tsdb --parser = csv , --fields = ID,TIME,P1,P2,P3,P4,P5,P6 --mqltmpl = insert into /test_perf_tsdb (id, testvalue) values (?, ?) at ? --mqltmpl_fields = ID,testvalue,attime --ignore = false --direct = true --fields_type = VAR,INT,INT,INT,INT,INT,VAR,VAR --var_testvalue = array P1,P2,P3,P4,P5,P6 --var_attime = field TIME # toe # # log test perf tsdb [LogTestPerfTsdbInput] type = "LogstreamerInput" log_directory = "/opt/matrix/var/test" file_match = "test_perf_tsdb.csv" splitter = "split_n" [LogTestPerfTsdbOutput] type = "NatsOutput" is_streaming = true subject = "matrix.rules.test.perf.tsdb" reconnect = true message_matcher = "Logger == 'LogTestPerfTsdbInput'" encoder = "PayloadEncoder" use_protocol = true [LogTestPerfTsdbOutput.attr]