■ 付録 ① Fluxの使用例1 > testInfo = from(bucket:"testdb/autogen") |> range(start: 2022-07-12T09:23:20Z , stop: 2022-07-12T09:23:21Z) |> filter(fn: (r) => r._measurement == "testmsr" and r._field == "ip_src" ) > testInfo |> yield() Result: _result Table: keys: [_start, _stop, _field, _measurement, ip_dst] _start:time _stop:time _field:string _measurement:string ip_dst:string _time:time _value:string ------------------------------ ------------------------------ ---------------------- ---------------------- ---------------------- ------------------------------ ---------------------- 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z ip_src testmsr 192.168.13.4 2022-07-12T09:23:20.000000000Z 172.16.0.1 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z ip_src testmsr 192.168.13.4 2022-07-12T09:23:21.000000000Z 172.16.0.2 > rsrcInfo = from(bucket:"testdb/autogen") |> range(start: 2022-07-12T09:23:19Z , stop: 2022-07-12T09:23:20Z) |> filter(fn: (r) => r._measurement == "resourcemsr" and r._field == "use_cpu" ) > rsrcInfo |> yield() Result: _result Table: keys: [_start, _stop, _field, _measurement] _start:time _stop:time _field:string _measurement:string _time:time _value:float ------------------------------ ------------------------------ ---------------------- ---------------------- ------------------------------ ---------------------------- 2022-07-12T09:23:19.000000000Z 2022-07-12T09:23:20.000000000Z use_cpu resourcemsr 2022-07-12T09:23:19.000000000Z 10 2022-07-12T09:23:19.000000000Z 2022-07-12T09:23:20.000000000Z use_cpu resourcemsr 2022-07-12T09:23:20.000000000Z 30 > join(tables: {ip_srcInfo: testInfo, cpuInfo: rsrcInfo}, on: ["_time"]) |> yield() Result: _result Table: keys: [_field_cpuInfo, _field_ip_srcInfo, _measurement_cpuInfo, _measurement_ip_srcInfo, _start_cpuInfo, _start_ip_srcInfo, _stop_cpuInfo, _stop_ip_srcInfo, ip_dst] _field_cpuInfo:string _field_ip_srcInfo:string _measurement_cpuInfo:string _measurement_ip_srcInfo:string _start_cpuInfo:time _start_ip_srcInfo:time _stop_cpuInfo:time _stop_ip_srcInfo:time ip_dst:string _time:time _value_cpuInfo:float _value_ip_srcInfo:string ---------------------- ------------------------ --------------------------- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ------------------------------ ---------------------- ------------------------------ ---------------------------- ------------------------ use_cpu ip_src resourcemsr testmsr 2022-07-12T09:23:19.000000000Z 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z 192.168.13.4 2022-07-12T09:23:20.000000000Z ② Fluxの使用例2 > testInfo = from(bucket:"testdb/autogen") |> range(start: 2022-07-12T09:23:20Z , stop: 2022-07-12T09:23:21Z) |> filter(fn: (r) => r._measurement == "testmsr" and r._field == "port_dst" or r._field == "port_src" ) > testInfo |> yield() Result: _result Table: keys: [_start, _stop, _field, _measurement, ip_dst] _start:time _stop:time _field:string _measurement:string ip_dst:string _time:time _value:int ------------------------------ ------------------------------ ---------------------- ---------------------- ---------------------- ------------------------------ -------------------------- 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z port_dst testmsr 192.168.13.4 2022-07-12T09:23:20.000000000Z 53331 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z port_dst testmsr 192.168.13.4 2022-07-12T09:23:21.000000000Z 53331 Table: keys: [_start, _stop, _field, _measurement, ip_dst] _start:time _stop:time _field:string _measurement:string ip_dst:string _time:time _value:int ------------------------------ ------------------------------ ---------------------- ---------------------- ---------------------- ------------------------------ -------------------------- 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z port_src testmsr 192.168.13.4 2022-07-12T09:23:20.000000000Z 60000 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z port_src testmsr 192.168.13.4 2022-07-12T09:23:21.000000000Z 60001 > rsrcInfo = from(bucket:"testdb/autogen") |> range(start: 2022-07-12T09:23:20Z , stop: 2022-07-12T09:23:21Z) |> filter(fn: (r) => r._measurement == "resourcemsr" ) > rsrcInfo |> yield() Result: _result Table: keys: [_start, _stop, _field, _measurement] _start:time _stop:time _field:string _measurement:string _time:time _value:float ------------------------------ ------------------------------ ---------------------- ---------------------- ------------------------------ ---------------------------- 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z use_cpu resorcemsr 2022-07-12T09:23:20.000000000Z 30 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z use_cpu resorcemsr 2022-07-12T09:23:21.000000000Z 60 Table: keys: [_start, _stop, _field, _measurement] _start:time _stop:time _field:string _measurement:string _time:time _value:float ------------------------------ ------------------------------ ---------------------- ---------------------- ------------------------------ ---------------------------- 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z use_mem resorcemsr 2022-07-12T09:23:20.000000000Z 40 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z use_mem resorcemsr 2022-07-12T09:23:21.000000000Z 70 Table: keys: [_start, _stop, _field, _measurement] _start:time _stop:time _field:string _measurement:string _time:time _value:float ------------------------------ ------------------------------ ---------------------- ---------------------- ------------------------------ ---------------------------- 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z use_storage resorcemsr 2022-07-12T09:23:20.000000000Z 50 > join(tables: {port_Info: testInfo, resourceInfo: rsrcInfo}, on: ["_time"]) |> yield() Result: _result Table: keys: [_field_port_Info, _field_resourceInfo, _measurement_port_Info, _measurement_resourceInfo, _start_port_Info, _start_resourceInfo, _stop_port_Info, _stop_resourceInfo, ip_dst] _field_port_Info:string _field_resourceInfo:string _measurement_port_Info:string _measurement_resourceInfo:string _start_port_Info:time _start_resourceInfo:time _stop_port_Info:time _stop_resourceInfo:time ip_dst:string _time:time _value_port_Info:int _value_resourceInfo:float ----------------------- -------------------------- ----------------------------- -------------------------------- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ---------------------- ------------------------------ -------------------------- ---------------------------- port_dst use_cpu testmsr resourcemsr 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z 2022-07-12T09:23:21.000000000Z 192.168.13.4 2022-07-12T09:23:20.000000000Z 53331 30 port_dst use_cpu testmsr resourcemsr 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z 2022-07-12T09:23:21.000000000Z 192.168.13.4 2022-07-12T09:23:21.000000000Z 53331 60 Table: keys: [_field_port_Info, _field_resourceInfo, _measurement_port_Info, _measurement_resourceInfo, _start_port_Info, _start_resourceInfo, _stop_port_Info, _stop_resourceInfo, ip_dst] _field_port_Info:string _field_resourceInfo:string _measurement_port_Info:string _measurement_resourceInfo:string _start_port_Info:time _start_resourceInfo:time _stop_port_Info:time _stop_resourceInfo:time ip_dst:string _time:time _value_port_Info:int _value_resourceInfo:float ----------------------- -------------------------- ----------------------------- -------------------------------- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ---------------------- ------------------------------ -------------------------- ---------------------------- port_dst use_mem testmsr resourcemsr 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z 2022-07-12T09:23:21.000000000Z 192.168.13.4 2022-07-12T09:23:20.000000000Z 53331 40 port_dst use_mem testmsr resourcemsr 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z 2022-07-12T09:23:21.000000000Z 192.168.13.4 2022-07-12T09:23:21.000000000Z 53331 70 Table: keys: [_field_port_Info, _field_resourceInfo, _measurement_port_Info, _measurement_resourceInfo, _start_port_Info, _start_resourceInfo, _stop_port_Info, _stop_resourceInfo, ip_dst] _field_port_Info:string _field_resourceInfo:string _measurement_port_Info:string _measurement_resourceInfo:string _start_port_Info:time _start_resourceInfo:time _stop_port_Info:time _stop_resourceInfo:time ip_dst:string _time:time _value_port_Info:int _value_resourceInfo:float ----------------------- -------------------------- ----------------------------- -------------------------------- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ---------------------- ------------------------------ -------------------------- ---------------------------- port_dst use_storage testmsr resourcemsr 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z 2022-07-12T09:23:21.000000000Z 192.168.13.4 2022-07-12T09:23:20.000000000Z 53331 50 Table: keys: [_field_port_Info, _field_resourceInfo, _measurement_port_Info, _measurement_resourceInfo, _start_port_Info, _start_resourceInfo, _stop_port_Info, _stop_resourceInfo, ip_dst] _field_port_Info:string _field_resourceInfo:string _measurement_port_Info:string _measurement_resourceInfo:string _start_port_Info:time _start_resourceInfo:time _stop_port_Info:time _stop_resourceInfo:time ip_dst:string _time:time _value_port_Info:int _value_resourceInfo:float ----------------------- -------------------------- ----------------------------- -------------------------------- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ---------------------- ------------------------------ -------------------------- ---------------------------- port_src use_cpu testmsr resourcemsr 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z 2022-07-12T09:23:21.000000000Z 192.168.13.4 2022-07-12T09:23:20.000000000Z 60000 30 port_src use_cpu testmsr resourcemsr 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z 2022-07-12T09:23:21.000000000Z 192.168.13.4 2022-07-12T09:23:21.000000000Z 60001 60 Table: keys: [_field_port_Info, _field_resourceInfo, _measurement_port_Info, _measurement_resourceInfo, _start_port_Info, _start_resourceInfo, _stop_port_Info, _stop_resourceInfo, ip_dst] _field_port_Info:string _field_resourceInfo:string _measurement_port_Info:string _measurement_resourceInfo:string _start_port_Info:time _start_resourceInfo:time _stop_port_Info:time _stop_resourceInfo:time ip_dst:string _time:time _value_port_Info:int _value_resourceInfo:float ----------------------- -------------------------- ----------------------------- -------------------------------- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ---------------------- ------------------------------ -------------------------- ---------------------------- port_src use_mem testmsr resourcemsr 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z 2022-07-12T09:23:21.000000000Z 192.168.13.4 2022-07-12T09:23:20.000000000Z 60000 40 port_src use_mem testmsr resourcemsr 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z 2022-07-12T09:23:21.000000000Z 192.168.13.4 2022-07-12T09:23:21.000000000Z 60001 70 Table: keys: [_field_port_Info, _field_resourceInfo, _measurement_port_Info, _measurement_resourceInfo, _start_port_Info, _start_resourceInfo, _stop_port_Info, _stop_resourceInfo, ip_dst] _field_port_Info:string _field_resourceInfo:string _measurement_port_Info:string _measurement_resourceInfo:string _start_port_Info:time _start_resourceInfo:time _stop_port_Info:time _stop_resourceInfo:time ip_dst:string _time:time _value_port_Info:int _value_resourceInfo:float ----------------------- -------------------------- ----------------------------- -------------------------------- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ---------------------- ------------------------------ -------------------------- ---------------------------- port_src use_storage testmsr resourcemsr 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:20.000000000Z 2022-07-12T09:23:21.000000000Z 2022-07-12T09:23:21.000000000Z 192.168.13.4 2022-07-12T09:23:20.000000000Z 60000 50