Skip to content

Commit 8d10584

Browse files
authored
Merge pull request #56335 from skrthomas/OSDOCS-5288
OSDOCS-5288:Exporting flow data to Kafka
2 parents d5d04c7 + f7fc2d4 commit 8d10584

8 files changed

+392
-2
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,8 @@ Topics:
14441444
File: observing-network-traffic
14451445
- Name: API reference
14461446
File: flowcollector-api
1447+
- Name: JSON flows format reference
1448+
File: json-flows-format-reference
14471449
- Name: Troubleshooting Network Observability
14481450
File: troubleshooting-network-observability
14491451
---
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Module included in the following assemblies:
2+
//
3+
// network_observability/configuring-operator.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="network-observability-enriched-flows-kafka_{context}"]
7+
= Export enriched network flow data
8+
9+
You can send network flows to Kafka, so that they can be consumed by any processor or storage that supports Kafka input, such as Splunk, Elasticsearch, or Fluentd.
10+
11+
.Prerequisites
12+
* Installed Kafka
13+
14+
.Procedure
15+
16+
. In the web console, navigate to *Operators* -> *Installed Operators*.
17+
. Under the *Provided APIs* heading for the *NetObserv Operator*, select *Flow Collector*.
18+
. Select *cluster* and then select the *YAML* tab.
19+
. Edit the `FlowCollector` to configure `spec.exporters` as follows:
20+
+
21+
[source,yaml]
22+
----
23+
apiVersion: flows.netobserv.io/v1alpha1
24+
kind: FlowCollector
25+
metadata:
26+
name: cluster
27+
spec:
28+
exporters:
29+
- type: KAFKA
30+
kafka:
31+
address: "kafka-cluster-kafka-bootstrap.netobserv"
32+
topic: netobserv-flows-export <1>
33+
tls:
34+
enable: false <2>
35+
36+
----
37+
<1> The Network Observability Operator exports all flows to the configured Kafka topic.
38+
<2> You can encrypt all communications to and from Kafka with SSL/TLS or mTLS. When enabled, the Kafka CA certificate must be available as a ConfigMap or a Secret, both in the namespace where the `flowlogs-pipeline` processor component is deployed (default: netobserv). It must be referenced with `spec.exporters.tls.caCert`. When using mTLS, client secrets must be available in these namespaces as well (they can be generated for instance using the AMQ Streams User Operator) and referenced with `spec.exporters.tls.userCert`.
39+
. After configuration, network flows data can be sent to an available output in a JSON format. For more information, see _Network flows format reference_

modules/network-observability-flowcollector-kafka-config.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ The following example shows how to modify the `FlowCollector` resource for {prod
2323
<1> Set `spec.deploymentModel` to `KAFKA` instead of `DIRECT` to enable the Kafka deployment model.
2424
<2> `spec.kafka.address` refers to the Kafka bootstrap server address. You can specify a port if needed, for instance `kafka-cluster-kafka-bootstrap.netobserv:9093` for using TLS on port 9093.
2525
<3> `spec.kafka.topic` should match the name of a topic created in Kafka.
26-
<4> `spec.kafka.tls` can be used to encrypt all communications to and from Kafka with TLS or mTLS. When enabled, the Kafka CA certificate must be available as a ConfigMap or a Secret, both in the namespace where the flowlogs-pipeline processor component is deployed (default: `netobserv`) and where the eBPF agents are deployed (default: `netobserv-privileged`). It must be referenced with `spec.kafka.tls.caCert`. When using mTLS, client secrets must be available in these namespaces as well (they can be generated for instance using the AMQ Streams User Operator) and referenced with `spec.kafka.tls.userCert`.
26+
<4> `spec.kafka.tls` can be used to encrypt all communications to and from Kafka with TLS or mTLS. When enabled, the Kafka CA certificate must be available as a ConfigMap or a Secret, both in the namespace where the `flowlogs-pipeline` processor component is deployed (default: `netobserv`) and where the eBPF agents are deployed (default: `netobserv-privileged`). It must be referenced with `spec.kafka.tls.caCert`. When using mTLS, client secrets must be available in these namespaces as well (they can be generated for instance using the AMQ Streams User Operator) and referenced with `spec.kafka.tls.userCert`.
Lines changed: 322 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,322 @@
1+
// Automatically generated by 'hack/asciidoc-flows-gen.sh'. Do not edit.
2+
// Module included in the following assemblies:
3+
// json-flows-format-reference.adoc
4+
5+
:_content-type: REFERENCE
6+
[id="network-observability-flows-format_{context}"]
7+
= Network Flows format reference
8+
The document is organized in two main categories: _Labels_ and regular _Fields_. This distinction only matters when querying Loki. This is because _Labels_, unlike _Fields_, must be used in link:https://grafana.com/docs/loki/latest/logql/log_queries/#log-stream-selector[stream selectors].
9+
10+
If you are reading this specification as a reference for the Kafka export feature, you must treat all _Labels_ and _Fields_ as regualr fields and ignore any distinctions between them that are specific to Loki.
11+
12+
13+
== Labels
14+
15+
'''
16+
17+
SrcK8S_Namespace::
18+
19+
• `Optional` *SrcK8S_Namespace*: `string`
20+
21+
Source namespace
22+
23+
'''
24+
25+
DstK8S_Namespace::
26+
27+
• `Optional` *DstK8S_Namespace*: `string`
28+
29+
Destination namespace
30+
31+
'''
32+
33+
SrcK8S_OwnerName::
34+
35+
• `Optional` *SrcK8S_OwnerName*: `string`
36+
37+
Source owner, such as Deployment, StatefulSet, etc.
38+
39+
'''
40+
41+
DstK8S_OwnerName::
42+
43+
• `Optional` *DstK8S_OwnerName*: `string`
44+
45+
Destination owner, such as Deployment, StatefulSet, etc.
46+
47+
'''
48+
49+
FlowDirection::
50+
51+
• *FlowDirection*: see the following section, _Enumeration: FlowDirection_ for more details.
52+
53+
Flow direction from the node observation point
54+
55+
'''
56+
57+
_RecordType::
58+
59+
• `Optional` *_RecordType*: `RecordType`
60+
61+
Type of record: 'flowLog' for regular flow logs, or 'allConnections',
62+
'newConnection', 'heartbeat', 'endConnection' for conversation tracking
63+
64+
== Fields
65+
66+
'''
67+
68+
SrcAddr::
69+
70+
• *SrcAddr*: `string`
71+
72+
Source IP address (ipv4 or ipv6)
73+
74+
'''
75+
76+
DstAddr::
77+
78+
• *DstAddr*: `string`
79+
80+
Destination IP address (ipv4 or ipv6)
81+
82+
'''
83+
84+
SrcMac::
85+
86+
• *SrcMac*: `string`
87+
88+
Source MAC address
89+
90+
'''
91+
92+
DstMac::
93+
94+
• *DstMac*: `string`
95+
96+
Destination MAC address
97+
98+
'''
99+
100+
SrcK8S_Name::
101+
102+
• `Optional` *SrcK8S_Name*: `string`
103+
104+
Name of the source matched Kubernetes object, such as Pod name, Service name, etc.
105+
106+
'''
107+
108+
DstK8S_Name::
109+
110+
• `Optional` *DstK8S_Name*: `string`
111+
112+
Name of the destination matched Kubernetes object, such as Pod name, Service name, etc.
113+
114+
'''
115+
116+
SrcK8S_Type::
117+
118+
• `Optional` *SrcK8S_Type*: `string`
119+
120+
Kind of the source matched Kubernetes object, such as Pod, Service, etc.
121+
122+
'''
123+
124+
DstK8S_Type::
125+
126+
• `Optional` *DstK8S_Type*: `string`
127+
128+
Kind of the destination matched Kubernetes object, such as Pod name, Service name, etc.
129+
130+
'''
131+
132+
SrcPort::
133+
134+
• *SrcPort*: `number`
135+
136+
Source port
137+
138+
'''
139+
140+
DstPort::
141+
142+
• *DstPort*: `number`
143+
144+
Destination port
145+
146+
'''
147+
148+
SrcK8S_OwnerType::
149+
150+
• `Optional` *SrcK8S_OwnerType*: `string`
151+
152+
Kind of the source Kubernetes owner, such as Deployment, StatefulSet, etc.
153+
154+
'''
155+
156+
DstK8S_OwnerType::
157+
158+
• `Optional` *DstK8S_OwnerType*: `string`
159+
160+
Kind of the destination Kubernetes owner, such as Deployment, StatefulSet, etc.
161+
162+
'''
163+
164+
SrcK8S_HostIP::
165+
166+
• `Optional` *SrcK8S_HostIP*: `string`
167+
168+
Source node IP
169+
170+
'''
171+
172+
DstK8S_HostIP::
173+
174+
• `Optional` *DstK8S_HostIP*: `string`
175+
176+
Destination node IP
177+
178+
'''
179+
180+
SrcK8S_HostName::
181+
182+
• `Optional` *SrcK8S_HostName*: `string`
183+
184+
Source node name
185+
186+
'''
187+
188+
DstK8S_HostName::
189+
190+
• `Optional` *DstK8S_HostName*: `string`
191+
192+
Destination node name
193+
194+
'''
195+
196+
Proto::
197+
198+
• *Proto*: `number`
199+
200+
L4 protocol
201+
202+
'''
203+
204+
Interface::
205+
206+
• `Optional` *Interface*: `string`
207+
208+
Network interface
209+
210+
'''
211+
Packets::
212+
213+
• *Packets*: `number`
214+
215+
Number of packets in this flow
216+
217+
218+
'''
219+
220+
Packets_AB::
221+
222+
• `Optional` *Packets_AB*: `number`
223+
224+
In conversation tracking, A to B packets counter per conversation
225+
226+
'''
227+
228+
Packets_BA::
229+
230+
• `Optional` *Packets_BA*: `number`
231+
232+
In conversation tracking, B to A packets counter per conversation
233+
234+
'''
235+
236+
Bytes::
237+
238+
• *Bytes*: `number`
239+
240+
Number of bytes in this flow
241+
242+
'''
243+
244+
Bytes_AB::
245+
246+
• `Optional` *Bytes_AB*: `number`
247+
248+
In conversation tracking, A to B bytes counter per conversation
249+
250+
'''
251+
252+
Bytes_BA::
253+
254+
• `Optional` *Bytes_BA*: `number`
255+
256+
In conversation tracking, B to A bytes counter per conversation
257+
258+
'''
259+
260+
TimeFlowStartMs::
261+
262+
• *TimeFlowStartMs*: `number`
263+
264+
Start timestamp of this flow, in milliseconds
265+
266+
'''
267+
268+
TimeFlowEndMs::
269+
270+
• *TimeFlowEndMs*: `number`
271+
272+
End timestamp of this flow, in milliseconds
273+
274+
'''
275+
276+
TimeReceived::
277+
278+
• *TimeReceived*: `number`
279+
280+
Timestamp when this flow was received and processed by the flow collector, in seconds
281+
282+
'''
283+
284+
_HashId::
285+
286+
• `Optional` *_HashId*: `string`
287+
288+
In conversation tracking, the conversation identifier
289+
290+
'''
291+
292+
_IsFirst::
293+
294+
• `Optional` *_IsFirst*: `string`
295+
296+
In conversation tracking, a flag identifying the first flow
297+
298+
'''
299+
300+
numFlowLogs::
301+
302+
• `Optional` *numFlowLogs*: `number`
303+
304+
In conversation tracking, a counter of flow logs per conversation
305+
306+
== Enumeration: FlowDirection
307+
308+
'''
309+
310+
Ingress::
311+
312+
• *Ingress* = `"0"`
313+
314+
Incoming traffic, from node observation point
315+
316+
'''
317+
318+
Egress::
319+
320+
• *Egress* = `"1"`
321+
322+
Outgoing traffic, from node observation point

modules/network-observability-operator-install.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ This documentation assumes that your `LokiStack` instance name is `loki`. Using
2727
+
2828
* *spec.agent.ebpf.Sampling* : Specify a sampling size for flows. Lower sampling sizes will have higher impact on resource utilization. For more information, see the `FlowCollector` API reference, under spec.agent.ebpf.
2929
* *spec.deploymentModel*: If you are using Kafka, verify Kafka is selected.
30+
* *spec.exporters*: If you are using Kafka, you can optionally send network flows to Kafka, so that they can be consumed by any processor or storage that supports Kafka input, such as Splunk, Elasticsearch, or Fluentd. To do this, set the following specifications:
31+
** Set the *type* to `KAFKA`.
32+
** Set the *address* as `kafka-cluster-kafka-bootstrap.netobserv`.
33+
** Set the *topic* as `netobserv-flows-export`. The Operator exports all flows to the configured Kafka topic.
34+
** Set the following *tls* specifications:
35+
*** *certFile*: `service-ca.crt`, *name*: `kafka-gateway-ca-bundle`, and *type*: `configmap`.
36+
+
37+
You can also configure this option at a later time by directly editing the YAML. For more information, see _Export enriched network flow data_.
3038
* *loki.url*: Since authentication is specified separately, this URL needs to be updated to `https://loki-gateway-http.netobserv.svc:8080/api/logs/v1/network`. The first part of the URL, "loki", should match the name of your LokiStack.
3139
* *loki.statusUrl*: Set this to `https://loki-query-frontend-http.netobserv.svc:3100/`. The first part of the URL, "loki", should match the name of your LokiStack.
3240
* *loki.authToken*: Select the `FORWARD` value.

0 commit comments

Comments
 (0)