-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(site/dev) Add fluentbit operator client to kueyen
- Loading branch information
Showing
8 changed files
with
216 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
apiVersion: fluentbit.fluent.io/v1alpha2 | ||
kind: ClusterFilter | ||
metadata: | ||
name: kubernetes-metadata | ||
namespace: fluent-operator | ||
spec: | ||
filters: | ||
- kubernetes: | ||
labels: true | ||
annotations: false | ||
mergeLog: true | ||
keepLog: false | ||
k8sLoggingParser: true | ||
k8sLoggingExclude: true | ||
- lua: | ||
script: | | ||
function containerd(tag, timestamp, record) | ||
if(record["logtag"]~=nil) then | ||
timeStr = os.date("!*t", timestamp["sec"]) | ||
t = string.format("%4d-%02d-%02dT%02d:%02d:%02d.%sZ", | ||
timeStr["year"], timeStr["month"], timeStr["day"], | ||
timeStr["hour"], timeStr["min"], timeStr["sec"], | ||
timestamp["nsec"]) | ||
record["time"] = t | ||
record["log"] = record["message"] | ||
record["message"] = nil | ||
return 1, timestamp, record | ||
else | ||
return 0, timestamp, record | ||
end | ||
end | ||
call: containerd | ||
- nest: | ||
operation: lift | ||
nested_under: kubernetes | ||
add_prefix: kubernetes_ | ||
- modify: | ||
add: | ||
- cluster: ${CLUSTER_NAME} | ||
remove: | ||
- stream | ||
- kubernetes_pod_id | ||
- kubernetes_host | ||
- kubernetes_container_hash | ||
match: kube.* |
21 changes: 21 additions & 0 deletions
21
fleet/lib/fluent-operator/client/clustermultilineparser.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: fluentbit.fluent.io/v1alpha2 | ||
kind: ClusterMultilineParser | ||
metadata: | ||
name: multiline-parser | ||
namespace: fluent-operator | ||
labels: | ||
fluentbit.fluent.io/enabled: "true" | ||
spec: | ||
parsers: | ||
- name: multiline-regex | ||
type: regex | ||
# Patrón para logs de Java/Go stack traces | ||
rules: | ||
- state: start_state | ||
pattern: '^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}' | ||
- state: cont | ||
pattern: '^\s+at' | ||
- state: cont | ||
pattern: '^\s+...' | ||
- state: cont | ||
pattern: '^Caused by:' |
31 changes: 31 additions & 0 deletions
31
fleet/lib/fluent-operator/client/clusteroutput-fluentbit-loki.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apiVersion: fluentbit.fluent.io/v1alpha2 | ||
kind: ClusterOutput | ||
metadata: | ||
labels: | ||
fluentbit.fluent.io/enabled: "true" | ||
name: fluentbit-output-loki | ||
namespace: fluent-operator | ||
spec: | ||
matchRegex: (?:kube|service)\.(.*) | ||
loki: | ||
host: loki.kueyen.dev.lsst.org | ||
port: 443 | ||
tls: | ||
verify: false | ||
labels: | ||
- job=fluentbit | ||
- k8s_namespace=$kubernetes['namespace_name'] | ||
- k8s_pod_name=$kubernetes['pod_name'] | ||
- k8s_container_name=$kubernetes['container_name'] | ||
- k8s_host=$kubernetes['host'] | ||
- k8s_image=$kubernetes['container_image'] | ||
- cluster="${CLUSTER_NAME}" | ||
label_keys: | ||
- app | ||
- release | ||
- component | ||
- k8s-app | ||
line_format: json | ||
auto_kubernetes_labels: true | ||
retry_limit: 3 | ||
buffer_size: "100MB" |
7 changes: 7 additions & 0 deletions
7
fleet/lib/fluent-operator/client/configmap-cluster-metadata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: cluster-metadata | ||
namespace: fluent-operator | ||
data: | ||
CLUSTER_NAME: ${CLUSTER_NAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
resources: | ||
- clusteroutput-fluentbit-loki.yaml | ||
- configmap-cluster-metadata.yaml | ||
- clusterfilter.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
defaultNamespace: &name fluent-operator | ||
labels: | ||
bundle: *name | ||
namespaceLabels: | ||
lsst.io/discover: "true" | ||
kustomize: | ||
dir: client | ||
helm: | ||
chart: *name | ||
releaseName: *name | ||
repo: https://fluent.github.io/helm-charts | ||
version: 3.2.0 | ||
waitForJobs: true | ||
values: | ||
clusterName: ${CLUSTER_NAME} | ||
fluentbit: | ||
resources: | ||
limits: | ||
cpu: 200m | ||
memory: 256Mi | ||
requests: | ||
cpu: 100m | ||
memory: 128Mi | ||
labels: | ||
lsst.team.io/infra: "true" | ||
lsst.io/role: logging | ||
lsst.io/component: fluent-bit | ||
lsst.io/env: kube | ||
lsst.io/project: o11y | ||
extraEnv: | ||
- name: NODE_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: spec.nodeName | ||
- name: CLUSTER_NAME | ||
valueFrom: | ||
configMapKeyRef: | ||
name: cluster-metadata | ||
key: CLUSTER_NAME | ||
|
||
targetCustomizations: | ||
- name: kueyen | ||
clusterName: kueyen | ||
- name: ayekan | ||
clusterName: ayekan | ||
- name: ruka | ||
clusterName: ruka |