Skip to content

Commit

Permalink
Loki output (#102)
Browse files Browse the repository at this point in the history
- Loki plugin example
- Fluentbit fix version
- New logo
  • Loading branch information
ahma authored Jun 19, 2019
1 parent e1a8bac commit 06ca5e6
Show file tree
Hide file tree
Showing 12 changed files with 142 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p align="center"><img src="docs/img/logo.png" width="260"></p>
<p align="center"><img src="docs/img/logging.svg" width="260"></p>
<p align="center">

<a href="https://hub.docker.com/r/banzaicloud/logging-operator/">
Expand Down Expand Up @@ -65,7 +65,7 @@ Logging-operator is a core part of the [Pipeline](https://beta.banzaicloud.io) p

This operator helps you to pack together logging information with your applications. With the help of Custom Resource Definition you can describe the behaviour of your application within its charts. The operator does the rest.

<p align="center"><img src="docs/img/log_helm.gif" width="660"></p>
<p align="center"><img src="docs/img/loggingo_flow.png" width="660"></p>

## Example with helm chart
The following steps set up an example configuration for sending nginx logs to S3.
Expand Down
2 changes: 1 addition & 1 deletion deploy/crds/logging_v1alpha1_fluentbit_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
tls:
enabled: false
image:
tag: "latest"
tag: "1.1.3"
repository: "fluent/fluent-bit"
pullPolicy: "IfNotPresent"
resources: {}
2 changes: 1 addition & 1 deletion deploy/crds/logging_v1alpha1_fluentd_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
tls:
enabled: false
image:
tag: "v1.4.2"
tag: "v1.5.0"
repository: "banzaicloud/fluentd"
pullPolicy: "IfNotPresent"
volumeModImage:
Expand Down
Binary file removed docs/img/ll_es.png
Binary file not shown.
Binary file modified docs/img/lll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions docs/img/logging.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/loggingo_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions docs/plugins/loki.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Plugin loki
## Variables
| Variable name | Default | Applied function |
|---|---|---|
| pattern | - | |
| url | - | loki url |
| username | - | |
| password | - | |
| extraLabels | - | |
| flushInterval | 10s | |
| chunkLimitSize | 1m | |
| flushAtShutdown | true | |
## Plugin template
```
<match {{ .pattern }}.**>
@type kubernetes_loki
url {{ .url }}
username {{ .username }}
password {{ .password }}
extra_labels {{ .extraLabels }}
<buffer>
flush_interval {{ .flushInterval }}
chunk_limit_size {{ .chunkLimitSize }}
flush_at_shutdown {{ .flushAtShutdown }}
</buffer>
</match>
```
24 changes: 24 additions & 0 deletions example/loki_output.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: "logging.banzaicloud.com/v1alpha1"
kind: "Plugin"
metadata:
name: "loki-demo"
spec:
input:
label:
app: "nginx-logging-demo"
output:
- type: "loki"
name: "loki-demo"
parameters:
- name: url
value: "http://loki:3100"
- name: username
value: ""
- name: password
value: ""
- name: extraLabels
value: "{\"env\":\"dev\"}"
- name: flushInterval
value: "10s"
- name: bufferChunkLimit
value: "1m"
1 change: 1 addition & 0 deletions pkg/resources/plugins/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ func init() {
RegisterPlugin(AlibabaOutput, AlibabaTemplate, AlibabaDefaultValues)
RegisterPlugin(ParserFilter, ParserFilterTemplate, ParserFilterDefaultValues)
RegisterPlugin(ElasticsearchOutput, ElasticsearchTemplate, ElasticsearchDefaultValues)
RegisterPlugin(LokiOutput, LokiTemplate, LokiDefaultValues)
}
46 changes: 46 additions & 0 deletions pkg/resources/plugins/loki.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright © 2019 Banzai Cloud
*
* 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
*
* 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.
*/

package plugins

// LokiOutput CRD name
const LokiOutput = "loki"

// LokiDefaultValues for Loki output plugin
var LokiDefaultValues = map[string]string{
"url": "",
"username": "",
"password": "",
"extraLabels": "",
"flushInterval": "10s",
"chunkLimitSize": "1m",
"flushAtShutdown": "true",
}

// LokiTemplate for Loki output plugin
const LokiTemplate = `
<match {{ .pattern }}.**>
@type kubernetes_loki
url {{ .url }}
username {{ .username }}
password {{ .password }}
extra_labels {{ .extraLabels }}
<buffer>
flush_interval {{ .flushInterval }}
chunk_limit_size {{ .chunkLimitSize }}
flush_at_shutdown {{ .flushAtShutdown }}
</buffer>
</match>`

0 comments on commit 06ca5e6

Please sign in to comment.