-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from Howlla/versionBump1_28
PR - Fargate OSS pattern logs enabled | FluentBit
- Loading branch information
Showing
6 changed files
with
151 additions
and
15 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
42 changes: 42 additions & 0 deletions
42
lib/common/resources/fluent-bit/fluent-bit-fargate-config.ytpl
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,42 @@ | ||
kind: Namespace | ||
apiVersion: v1 | ||
metadata: | ||
name: aws-observability | ||
labels: | ||
aws-observability: enabled | ||
--- | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: aws-logging | ||
namespace: aws-observability | ||
data: | ||
flb_log_cw: "{{enableFlbProcessLogs}}" # Set to true to ship Fluent Bit process logs to CloudWatch. | ||
filters.conf: | | ||
[FILTER] | ||
Name parser | ||
Match * | ||
Key_name log | ||
Parser crio | ||
[FILTER] | ||
Name kubernetes | ||
Match kube.* | ||
Merge_Log On | ||
Keep_Log Off | ||
Buffer_Size 0 | ||
Kube_Meta_Cache_TTL 300s | ||
output.conf: | | ||
[OUTPUT] | ||
Name cloudwatch_logs | ||
Match kube.* | ||
region {{awsRegion}} | ||
log_group_name {{logGroupName}} | ||
log_stream_prefix {{log_stream_prefix}} | ||
auto_create_group true | ||
parsers.conf: | | ||
[PARSER] | ||
Name crio | ||
Format Regex | ||
Regex ^(?<time>[^ ]+) (?<stream>stdout|stderr) (?<logtag>P|F) (?<log>.*)$ | ||
Time_Key time | ||
Time_Format %Y-%m-%dT%H:%M:%S.%L%z |
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
79 changes: 79 additions & 0 deletions
79
lib/single-new-eks-fargate-opensource-observability-pattern/fluentbitconfigmap.ts
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,79 @@ | ||
import 'source-map-support/register'; | ||
import * as blueprints from '@aws-quickstart/eks-blueprints'; | ||
import { KubectlProvider, ManifestDeployment } from "@aws-quickstart/eks-blueprints/dist/addons/helm-addon/kubectl-provider"; | ||
import { loadYaml, readYamlDocument } from '@aws-quickstart/eks-blueprints/dist/utils'; | ||
|
||
/** | ||
* Configuration options for the fluentbit configmap | ||
*/ | ||
export interface FluentBitConfigMapProps { | ||
|
||
/** | ||
* Region to send cloudwatch logs. | ||
*/ | ||
awsRegion: string; | ||
|
||
/** | ||
* Log Group Name in cloudwatch | ||
*/ | ||
logGroupName: string | ||
|
||
/** | ||
* Prefix for logs stream | ||
*/ | ||
logStreamPrefix: string; | ||
|
||
/** | ||
* Enable logs from fluentBit process | ||
*/ | ||
enableFlbProcessLogs?: boolean | ||
} | ||
|
||
/** | ||
* Default props for the add-on. | ||
*/ | ||
const defaultProps: FluentBitConfigMapProps = { | ||
awsRegion: "us-east-1", | ||
logGroupName: "fargate-observability", | ||
logStreamPrefix: "from-fluent-bit-", | ||
enableFlbProcessLogs: false | ||
}; | ||
|
||
/** | ||
* Creates 'aws-observability' namespace and configurable ConfigMap | ||
* to enable the Fargate built-in log router based on Fluent Bit | ||
* https://docs.aws.amazon.com/eks/latest/userguide/fargate-logging.html | ||
*/ | ||
export class FluentBitConfigMap implements blueprints.ClusterAddOn { | ||
id?: string | undefined; | ||
readonly props: FluentBitConfigMapProps; | ||
|
||
constructor(props?: FluentBitConfigMapProps) { | ||
this.props = { ...defaultProps, ...props }; | ||
} | ||
|
||
deploy(clusterInfo: blueprints.ClusterInfo): void { | ||
const cluster = clusterInfo.cluster; | ||
|
||
const doc = readYamlDocument(__dirname + '/../common/resources/fluent-bit/fluent-bit-fargate-config.ytpl'); | ||
const manifest = doc.split("---").map(e => loadYaml(e)); | ||
|
||
const values: blueprints.Values = { | ||
awsRegion: this.props.awsRegion, | ||
logGroupName: this.props.logGroupName, | ||
log_stream_prefix: this.props.logStreamPrefix, | ||
enableFlbProcessLogs: this.props.enableFlbProcessLogs, | ||
}; | ||
|
||
const manifestDeployment: ManifestDeployment = { | ||
name: 'aws-logging', | ||
namespace: 'aws-observability', | ||
manifest, | ||
values | ||
}; | ||
|
||
const kubectlProvider = new KubectlProvider(clusterInfo); | ||
kubectlProvider.addManifest(manifestDeployment); | ||
|
||
} | ||
} |
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