Skip to content

Commit

Permalink
Merge pull request #16 from So1S/SO1S-231-fluent-bit-커스텀-설정
Browse files Browse the repository at this point in the history
SO1S-231 fluent bit 커스텀 설정
  • Loading branch information
shinilseop authored Aug 8, 2022
2 parents 1bbc7bd + 588d238 commit 76b14db
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 107 deletions.
2 changes: 1 addition & 1 deletion apps/dev/app-logging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:

source:
repoURL: git@github.com:So1S/deploy.git
targetRevision: SO1S-209-log-수집-툴-prometheus-연동
targetRevision: SO1S-231-fluent-bit-커스텀-설정
path: charts/logging

helm:
Expand Down
178 changes: 72 additions & 106 deletions charts/logging/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,31 +80,17 @@ config:
storage.checksum off
storage.backlog.mem_limit 5M
@INCLUDE application-log.conf
@INCLUDE dataplane-log.conf
@INCLUDE host-log.conf
@INCLUDE default-log.conf
@INCLUDE api-log.conf
@INCLUDE inference-log.conf
@INCLUDE logging-log.conf
application-log.conf: |
[INPUT]
Name tail
Tag application.*
Exclude_Path /var/log/containers/cloudwatch-agent*, /var/log/containers/fluent-bit*, /var/log/containers/aws-node*, /var/log/containers/kube-proxy*
Path /var/log/containers/*.log
Docker_Mode On
Docker_Mode_Flush 5
Docker_Mode_Parser container_firstline
Parser docker
DB /var/fluent-bit/state/flb_container.db
Mem_Buf_Limit 50MB
Skip_Long_Lines On
Refresh_Interval 10
Rotate_Wait 30
storage.type filesystem
Read_from_Head ${READ_FROM_HEAD}
logging-log.conf: |
[INPUT]
Name tail
Tag application.*
Alias fluent-bit
Tag logging.*
Path /var/log/containers/fluent-bit*
Parser docker
DB /var/fluent-bit/state/flb_log.db
Expand All @@ -115,7 +101,8 @@ config:
[INPUT]
Name tail
Tag application.*
Alias cloudwatch-agent
Tag logging.*
Path /var/log/containers/cloudwatch-agent*
Docker_Mode On
Docker_Mode_Flush 5
Expand All @@ -124,126 +111,108 @@ config:
DB /var/fluent-bit/state/flb_cwagent.db
Mem_Buf_Limit 5MB
Skip_Long_Lines On
Refresh_Interval 10
Refresh_Interval 10
Read_from_Head ${READ_FROM_HEAD}
[FILTER]
Name kubernetes
Match application.*
Kube_URL https://kubernetes.default.svc:443
Kube_Tag_Prefix application.var.log.containers.
Merge_Log On
Merge_Log_Key log_processed
K8S-Logging.Parser On
K8S-Logging.Exclude Off
Labels Off
Annotations Off
Use_Kubelet On
Kubelet_Port 10250
Buffer_Size 0
[OUTPUT]
Name cloudwatch_logs
Match application.*
Alias logging
Match logging.*
region ${AWS_REGION}
log_group_name /aws/containerinsights/${CLUSTER_NAME}/application
log_group_name /aws/containerinsights/${CLUSTER_NAME}/logging
log_stream_prefix ${HOST_NAME}-
auto_create_group true
extra_user_agent container-insights
dataplane-log.conf: |
[INPUT]
Name systemd
Tag dataplane.systemd.*
Systemd_Filter _SYSTEMD_UNIT=docker.service
Systemd_Filter _SYSTEMD_UNIT=kubelet.service
DB /var/fluent-bit/state/systemd.db
Path /var/log/journal
Read_From_Tail ${READ_FROM_TAIL}
api-log.conf: |
[INPUT]
Name tail
Tag dataplane.tail.*
Path /var/log/containers/aws-node*, /var/log/containers/kube-proxy*
Docker_Mode On
Docker_Mode_Flush 5
Docker_Mode_Parser container_firstline
Alias api-server
Tag backend.*
Path /var/log/containers/so1s-dev-deployment*
Parser docker
DB /var/fluent-bit/state/flb_dataplane_tail.db
DB /var/fluent-bit/state/backend_log.db
Mem_Buf_Limit 50MB
Skip_Long_Lines On
Refresh_Interval 10
Rotate_Wait 30
storage.type filesystem
Read_from_Head ${READ_FROM_HEAD}
[FILTER]
Name modify
Match dataplane.systemd.*
Rename _HOSTNAME hostname
Rename _SYSTEMD_UNIT systemd_unit
Rename MESSAGE message
Remove_regex ^((?!hostname|systemd_unit|message).)*$
[FILTER]
Name aws
Match dataplane.*
imds_version v1
[OUTPUT]
Name cloudwatch_logs
Match dataplane.*
Alias api-server
Match backend.*
region ${AWS_REGION}
log_group_name /aws/containerinsights/${CLUSTER_NAME}/dataplane
log_group_name /aws/containerinsights/${CLUSTER_NAME}/backend
log_stream_prefix ${HOST_NAME}-
auto_create_group true
extra_user_agent container-insights
host-log.conf: |
[INPUT]
Name tail
Tag host.dmesg
Path /var/log/dmesg
Parser syslog
DB /var/fluent-bit/state/flb_dmesg.db
Mem_Buf_Limit 5MB
Skip_Long_Lines On
Refresh_Interval 10
Read_from_Head ${READ_FROM_HEAD}
inference-log.conf: |
[INPUT]
Name tail
Tag host.messages
Path /var/log/messages
Parser syslog
DB /var/fluent-bit/state/flb_messages.db
Mem_Buf_Limit 5MB
Alias inference
Tag inference.*
Path /var/log/containers/inference-*
Parser docker
DB /var/fluent-bit/state/inference_log.db
Mem_Buf_Limit 50MB
Skip_Long_Lines On
Refresh_Interval 10
Rotate_Wait 30
storage.type filesystem
Read_from_Head ${READ_FROM_HEAD}
[OUTPUT]
Name cloudwatch_logs
Alias inference
Match inference.*
region ${AWS_REGION}
log_group_name /aws/containerinsights/${CLUSTER_NAME}/inference
log_stream_prefix ${HOST_NAME}-
auto_create_group true
extra_user_agent container-insights
default-log.conf: |
[INPUT]
Name tail
Tag host.secure
Path /var/log/secure
Parser syslog
DB /var/fluent-bit/state/flb_secure.db
Mem_Buf_Limit 5MB
Alias default
Tag application.*
Exclude_Path /var/log/containers/cloudwatch-agent*, /var/log/containers/fluent-bit*, /var/log/containers/aws-node*, /var/log/containers/kube-proxy*, /var/log/containers/so1s-dev-deployment*, /var/log/containers/inference-*
Path /var/log/containers/*.log
Docker_Mode On
Docker_Mode_Flush 5
Docker_Mode_Parser container_firstline
Parser docker
DB /var/fluent-bit/state/flb_container.db
Mem_Buf_Limit 50MB
Skip_Long_Lines On
Refresh_Interval 10
Rotate_Wait 30
storage.type filesystem
Read_from_Head ${READ_FROM_HEAD}
[FILTER]
Name aws
Match host.*
imds_version v1
Name kubernetes
Match *
Kube_URL https://kubernetes.default.svc:443
Merge_Log On
Merge_Log_Key log
K8S-Logging.Parser On
K8S-Logging.Exclude Off
Labels Off
Annotations Off
Use_Kubelet On
Buffer_Size 0
[OUTPUT]
Name cloudwatch_logs
Match host.*
Alias default
Match application.*
region ${AWS_REGION}
log_group_name /aws/containerinsights/${CLUSTER_NAME}/host
log_stream_prefix ${HOST_NAME}.
log_group_name /aws/containerinsights/${CLUSTER_NAME}/application
log_stream_prefix ${HOST_NAME}-
auto_create_group true
extra_user_agent container-insights
Expand All @@ -253,13 +222,10 @@ config:
Format json
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%LZ
[PARSER]
Name syslog
Format regex
Regex ^(?<time>[^ ]* {1,2}[^ ]* [^ ]*) (?<host>[^ ]*) (?<ident>[a-zA-Z0-9_\/\.\-]*)(?:\[(?<pid>[0-9]+)\])?(?:[^\:]*\:)? *(?<message>.*)$
Time_Key time
Time_Format %b %d %H:%M:%S
Time_Keep On
# Command | Decoder | Field | Optional Action |
# ==============|===========|=======|===================|
Decode_Field_As json log
[PARSER]
Name container_firstline
Expand Down
93 changes: 93 additions & 0 deletions charts/monitoring/dashboards/api-server-log.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"description": "API Server log",
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 28,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "cloudwatch",
"uid": "LAIPJrzVz"
},
"gridPos": {
"h": 13,
"w": 24,
"x": 0,
"y": 0
},
"id": 2,
"maxDataPoints": 6998,
"options": {
"dedupStrategy": "none",
"enableLogDetails": true,
"prettifyLogMessage": true,
"showCommonLabels": false,
"showLabels": false,
"showTime": true,
"sortOrder": "Descending",
"wrapLogMessage": true
},
"targets": [
{
"datasource": {
"type": "cloudwatch",
"uid": "LAIPJrzVz"
},
"expression": "fields @timestamp, @message\n| sort @timestamp desc\n| filter kubernetes.container_name=\"so1s-backend\"",
"id": "",
"logGroupNames": [
"/aws/containerinsights/So1s/backend"
],
"namespace": "",
"queryMode": "Logs",
"refId": "A",
"region": "default",
"statsGroups": []
}
],
"title": "API Server Logs",
"type": "logs"
}
],
"schemaVersion": 36,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-30m",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "API Server",
"uid": "YNgEJ9k4z",
"version": 2,
"weekStart": ""
}

0 comments on commit 76b14db

Please sign in to comment.