diff --git a/config/sample-config.yaml b/config/sample-config.yaml index 74fd05d19..beb6a2b27 100644 --- a/config/sample-config.yaml +++ b/config/sample-config.yaml @@ -10,13 +10,20 @@ loki: - DstK8S_OwnerName - FlowDirection - Duplicate - - _RecordType +# - _RecordType tenantID: netobserv authCheck: none useMocks: false frontend: recordTypes: - flowLog +# - newConnection +# - heartbeat +# - endConnection + features: +# - pktDrop +# - dnsTracking +# - flowRTT portNaming: enable: true portNames: @@ -359,7 +366,7 @@ frontend: tooltip: The type of the ICMP message field: IcmpType filter: icmp_type - default: true + default: false width: 10 - id: IcmpCode group: ICMP @@ -367,7 +374,7 @@ frontend: tooltip: The code of the ICMP message field: IcmpCode quickFilter: icmp_code - default: true + default: false width: 10 - id: FlowDirection name: Direction @@ -431,6 +438,8 @@ frontend: group: DNS name: DNS Latency tooltip: Time elapsed between DNS request and response. + field: DnsLatencyMs + filter: dns_latency default: true width: 5 - id: DNSResponseCode @@ -722,10 +731,6 @@ frontend: component: text placeholder: 'E.g: br-ex, ovn-k8s-mp0' hint: Specify a network interface. - - id: dscp - name: DSCP value - component: number - hint: Specify a Differentiated Services Code Point value as integer number. - id: id name: Conversation Id component: text @@ -800,7 +805,3 @@ frontend: alertNamespaces: - netobserv sampling: 50 - features: - - pktDrop - - dnsTracking - - flowRTT diff --git a/mocks/loki/flow_records.json b/mocks/loki/flow_records.json index 621578911..179dd440f 100644 --- a/mocks/loki/flow_records.json +++ b/mocks/loki/flow_records.json @@ -308,7 +308,7 @@ "values": [ [ "1689619351079000064", - "{\"SrcMac\":\"42:01:0A:00:00:01\",\"DstPort\":6443,\"SrcPort\":54082,\"Etype\":2048,\"SrcK8S_Type\":\"Node\",\"AgentIP\":\"10.0.0.5\",\"Bytes\":66,\"Packets\":1,\"SrcK8S_HostIP\":\"10.0.0.4\",\"SrcK8S_HostName\":\"ci-ln-hnd9rjk-72292-hnd5v-master-1\",\"SrcK8S_OwnerType\":\"Node\",\"Proto\":6,\"Flags\":16,\"SrcAddr\":\"10.0.0.4\",\"SrcK8S_Name\":\"ci-ln-hnd9rjk-72292-hnd5v-master-1\",\"DstMac\":\"42:01:0A:00:00:05\",\"TimeFlowStartMs\":1689619351079,\"Duplicate\":false,\"IfDirection\":0,\"TimeFlowEndMs\":1689619351079,\"TimeFlowRttNs\":1234,\"TimeReceived\":1689619351,\"DstAddr\":\"10.0.0.2\",\"Interface\":\"br-ex\"}" + "{\"SrcMac\":\"42:01:0A:00:00:01\",\"DstPort\":6443,\"SrcPort\":54082,\"Etype\":2048,\"SrcK8S_Type\":\"Node\",\"AgentIP\":\"10.0.0.5\",\"Bytes\":66,\"Packets\":1,\"SrcK8S_HostIP\":\"10.0.0.4\",\"SrcK8S_HostName\":\"ci-ln-hnd9rjk-72292-hnd5v-master-1\",\"SrcK8S_OwnerType\":\"Node\",\"Proto\":6,\"Flags\":16,\"SrcAddr\":\"10.0.0.4\",\"SrcK8S_Name\":\"ci-ln-hnd9rjk-72292-hnd5v-master-1\",\"DstMac\":\"42:01:0A:00:00:05\",\"TimeFlowStartMs\":1689619351079,\"Duplicate\":false,\"IfDirection\":0,\"TimeFlowEndMs\":1689619351079,\"TimeFlowRttNs\":1234,\"TimeReceived\":1689619351,\"DstAddr\":\"10.0.0.2\",\"Interface\":\"br-ex\",\"Dscp\":0,\"DnsLatencyMs\":10,\"DnsErrno\":0}" ], [ "1689619350793999872", diff --git a/web/src/api/ipfix.ts b/web/src/api/ipfix.ts index 7dfe93887..ba5f778e9 100644 --- a/web/src/api/ipfix.ts +++ b/web/src/api/ipfix.ts @@ -12,7 +12,16 @@ export interface Record { } export const getRecordValue = (record: Record, fieldOrLabel: string, defaultValue: string | number) => { - return record.fields[fieldOrLabel as keyof Fields] || record.labels[fieldOrLabel as keyof Labels] || defaultValue; + // check if label exists + if (record.labels[fieldOrLabel as keyof Labels] !== undefined) { + return record.labels[fieldOrLabel as keyof Labels]; + } + // check if field exists + if (record.fields[fieldOrLabel as keyof Fields] !== undefined) { + return record.fields[fieldOrLabel as keyof Fields]; + } + // fallback on default + return defaultValue; }; export interface Labels { diff --git a/web/src/components/netflow-record/record-field.tsx b/web/src/components/netflow-record/record-field.tsx index 80b7dcbee..f3f403094 100644 --- a/web/src/components/netflow-record/record-field.tsx +++ b/web/src/components/netflow-record/record-field.tsx @@ -535,7 +535,7 @@ export const RecordField: React.FC<{ return singleContainer( typeof value === 'number' && !isNaN(value) ? simpleTextWithTooltip( - detailed ? `${value}: ${getDNSErrorDescription(value as DNS_ERRORS_VALUES)}` : String(value) + detailed && value ? `${value}: ${getDNSErrorDescription(value as DNS_ERRORS_VALUES)}` : String(value) ) : emptyText() ); diff --git a/web/src/components/netflow-traffic.tsx b/web/src/components/netflow-traffic.tsx index 0e13461e1..1a69b6e9f 100644 --- a/web/src/components/netflow-traffic.tsx +++ b/web/src/components/netflow-traffic.tsx @@ -322,7 +322,13 @@ export const NetflowTraffic: React.FC<{ ); const getFilterDefs = React.useCallback(() => { - return getFilterDefinitions(config.filters, config.columns, t); + return getFilterDefinitions(config.filters, config.columns, t).filter( + fd => + (isConnectionTracking() || fd.id !== 'id') && + (isDNSTracking() || !fd.id.startsWith('dns_')) && + (isPktDrop() || !fd.id.startsWith('pkt_drop_')) && + (isFlowRTT() || fd.id !== 'time_flow_rtt') + ); // eslint-disable-next-line react-hooks/exhaustive-deps }, [config.columns, config.filters]);