-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
201 additions
and
145 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<p align="center"><img src="../img/lll.png" width="240"></p> | ||
|
||
## Example Logging-operator with Elasticsearch Operator | ||
<p align="center"><img src="../img/ll_es.gif" width="660"></p> | ||
|
||
|
||
#### Add operator chart repository: | ||
```bash | ||
$ helm repo add es-operator https://raw.githubusercontent.com/upmc-enterprises/elasticsearch-operator/master/charts/ | ||
$ helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com | ||
$ helm repo update | ||
``` | ||
|
||
#### Install operators | ||
```bash | ||
$ helm install --name elasticsearch-operator es-operator/elasticsearch-operator --set rbac.enabled=True | ||
$ helm install --name elasticsearch es-operator/elasticsearch --set kibana.enabled=True --set cerebro.enabled=True | ||
$ helm install --name loggingo banzaicloud-stable/logging-operator | ||
``` | ||
> [Elasticsearch Operator Documentation](https://github.com/upmc-enterprises/elasticsearch-operator) | ||
#### Install Nginx Demo chart | ||
```bash | ||
$ helm install banzaicloud-stable/nginx-logging-es-demo | ||
``` | ||
|
||
#### Forward cerebro & kibana dashboards | ||
```bash | ||
$ kubectl port-forward svc/cerebro-elasticsearch-cluster 9001:80 | ||
$ kubectl port-forward svc/kibana-elasticsearch-cluster 5601:80 | ||
``` | ||
|
||
[![asciicast](https://asciinema.org/a/9EcfIzlUQJSjJdopEh5HCU7OT.svg)](https://asciinema.org/a/9EcfIzlUQJSjJdopEh5HCU7OT) | ||
|
||
## License | ||
|
||
Copyright (c) 2017-2019 [Banzai Cloud, Inc.](https://banzaicloud.com) | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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,107 @@ | ||
<p align="center"><img src="../img/s3_logo.png" width="260"></p> | ||
|
||
|
||
#### Install S3 output Plugin chart with Aws Credential Access | ||
```bash | ||
$ helm install \ | ||
--set bucketName='<Mybucket>' \ | ||
--set region='<S3_REGION>' \ | ||
--set endpoint='<S3_ENDPOINT>' \ | ||
--set awsCredentialsAccess.enabled=true \ | ||
--set awsCredentialsAccess.secret.awsAccessValue='<AWS_ACCESS_KEY_ID>' \ | ||
--set awsCredentialsAccess.secret.awsSecretValue='<AWS_SECRET_ACCESS_KEY>' \ | ||
banzaicloud-stable/s3-output | ||
``` | ||
|
||
> There is **no** need to encode base64 these values. | ||
#### Install Nginx Demo app | ||
```bash | ||
$ helm install banzaicloud-stable/nginx-logging-demo | ||
``` | ||
|
||
|
||
### Create Secret | ||
|
||
Create a manifest file for the AWS access key: | ||
|
||
``` | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: loggings3 | ||
type: Opaque | ||
data: | ||
awsAccessKeyId: <base64encoded> | ||
awsSecretAccesKey: <base64encoded> | ||
``` | ||
|
||
Submit the secret with kubectl: | ||
|
||
``` | ||
kubectl apply -f secret.yaml | ||
``` | ||
|
||
### Create LoggingOperator resource | ||
|
||
Create a manifest that defines that you want to parse the nginx logs with the specified regular expressions on the standard output of pods with the `app: nginx` label, and store them in the given S3 bucket. | ||
|
||
``` | ||
apiVersion: "logging.banzaicloud.com/v1alpha1" | ||
kind: "Plugin" | ||
metadata: | ||
name: "nginx-logging" | ||
labels: | ||
release: test | ||
spec: | ||
input: | ||
label: | ||
app: nginx | ||
filter: | ||
- type: parser | ||
name: parser-nginx | ||
parameters: | ||
- name: format | ||
value: '/^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)"(?:\s+(?<http_x_forwarded_for>[^ ]+))?)?$/' | ||
- name: timeFormat | ||
value: "%d/%b/%Y:%H:%M:%S %z" | ||
output: | ||
- type: s3 | ||
name: outputS3 | ||
parameters: | ||
- name: aws_key_id | ||
valueFrom: | ||
secretKeyRef: | ||
name: loggings3 | ||
key: awsAccessKeyId | ||
- name: aws_sec_key | ||
valueFrom: | ||
secretKeyRef: | ||
name: loggings3 | ||
key: awsSecretAccesKey | ||
- name: s3_bucket | ||
value: logging-bucket | ||
- name: s3_region | ||
value: ap-northeast-1 | ||
- name: s3_endpoint | ||
value: https://s3.amazonaws.com | ||
``` | ||
|
||
|
||
|
||
## License | ||
|
||
Copyright (c) 2017-2019 [Banzai Cloud, Inc.](https://banzaicloud.com) | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.