Feat: update docs for v1.1.0 release

This commit is contained in:
ethfoo 2022-04-14 20:54:32 +08:00
parent d138bd35c5
commit 87abf34bf3
12 changed files with 191 additions and 29 deletions

View File

@ -51,7 +51,7 @@ Cluster级别CRD可用于
表示采集带有标签 `app: nginx`的所有Pod的日志。
!!! warning
在`type: pod`时下面的Pipeline只能使用file source此时的场景只能是采集日志。
在`type: pod`时下面的Pipeline只能使用file source此时的场景只能是采集日志。
### type: node
下发Pipeline配置至该批节点。

View File

@ -4,26 +4,56 @@ namespace级别CRD表示一个日志采集任务用于采集Pod容器日
!!! example
```yaml
apiVersion: loggie.io/v1beta1
kind: LogConfig
metadata:
name: nginx
namespace: default
spec:
selector:
type: pod
labelSelector:
app: nginx
pipeline:
sources: |
- type: file
name: mylog
paths:
- stdout
sinkRef: default
interceptorRef: default
```
=== "直接定义sink/interceptor方式"
```yaml
apiVersion: loggie.io/v1beta1
kind: LogConfig
metadata:
name: tomcat
namespace: default
spec:
selector:
type: pod
labelSelector:
app: tomcat
pipeline:
sources: |
- type: file
name: common
paths:
- stdout
sink: |
type: dev
printEvents: false
interceptors: |
- type: rateLimit
qps: 90000
```
=== "引用sink和interceptor方式"
```yaml
apiVersion: loggie.io/v1beta1
kind: LogConfig
metadata:
name: nginx
namespace: default
spec:
selector:
type: pod
labelSelector:
app: nginx
pipeline:
sources: |
- type: file
name: mylog
paths:
- stdout
sinkRef: default
interceptorRef: default
```
## spec.selector
表示Pipeline配置适用的范围可以选择采集一批Pods的日志
@ -106,6 +136,19 @@ namespace级别CRD表示一个日志采集任务用于采集Pod容器日
```
### interceptors
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |
| ---------- | ----------- | ----------- | --------- | -------- |
| interceptors | string | 非必填 | | 表示该Pipeline的interceptor使用方式和以上sources类似 |
### sink
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |
| ---------- | ----------- | ----------- | --------- | -------- |
| sink | string | 非必填 | | 表示该Pipeline的sink使用方式和以上的sources类似 |
如果你希望sink和interceptor可以在不同的ClusterLogConfig/LogConfig间复用则可以使用以下ref的方式
### sinkRef
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |

View File

@ -1,7 +1,10 @@
## 系统参数
- `-config.system`: 默认为loggie.yml表示指定Loggie系统配置的路径和文件名称
- `-config.pipeline`: 默认为pipelines.yml表示Pipeline配置文件所在的路径需要填写符合glob匹配的路径比如具体的路径和文件名`/etc/loggie/pipelines.yml`或者glob匹配的方式比如`/etc/loggie/*.yml`
- `-config.from`: 默认为file即默认使用文件的配置方式。可选env此时会从环境变量中读取配置此时不支持reload
- `-config.system`: 默认为loggie.yml表示指定Loggie系统配置的路径和文件名称。
(如果`-config.from=env`则为system配置的环境变量名称
- `-config.pipeline`: 默认为pipelines.yml表示Pipeline配置文件所在的路径需要填写符合glob匹配的路径比如具体的路径和文件名`/etc/loggie/pipelines.yml`或者glob匹配的方式比如`/etc/loggie/*.yml`。
(如果`-config.from=env`则为pipeline配置的环境变量名称
!!! warning
值得注意的是,如果`config.pipeline=/etc/loggie`glob匹配会认为`/etc/loggie`为`/etc`目录下的`loggie`文件,而不是匹配`/etc/loggie`目录下的文件,请避免类似的设置方式

View File

@ -37,8 +37,9 @@
| podLogDirPrefix | string | 非必填 | /var/log/pods | kubernetes默认放置的pod标准输出路径 |
| fields | map | 非必填 | | 自动添加的元信息 |
| fields.node.name | string | 非必填 | node.name | 添加所在节点node name作为元信息同时使用该值为key |
| fields.node.ip | string | 非必填 | node.ip | 添加所在节点node ip作为元信息同时使用该值为key |
| fields.namespace | string | 非必填 | namespace | 添加namespace作为元信息同时使用该值为key |
| fields.pod.name | string | 非必填 | pod.name | 添加pod name作为元信息同时使用该值为key |
| fields.pod.ip | string | 非必填 | pod.ip | 添加pod ip作为元信息同时使用该值为key |
| fields.container.name | string | 非必填 | container.name | 添加container name作为元信息同时使用该值为key |
| fields.logConfig | string | 非必填 | logConfig | 添加logConfig name作为元信息同时使用该值为key |
| fields.logConfig | string | 非必填 | logConfig | 添加logConfig name作为元信息同时使用该值为key |

View File

@ -88,3 +88,7 @@ Loggie定义了以下几个CRD用于在Kubernetes集群环境里下发配置
- [**Sink**](discovery/kubernetes/sink.md)cluster级别表示一个sink配置可以在LogConfig/ClusterLogConfig中引用该Sink。
- [**Interceptors**](discovery/kubernetes/interceptors.md)cluster级别表示一个interceptors组可以在LogConfig中引用该interceptors组。
!!! note
ClusterLogConfig/LogConfig中的pipeline可以定义sink和interceptor用于该pipeline的sink/interceptor。
如果你希望在多个ClusterLogConfig/LogConfig中复用sink或者interceptor可以创建Sink/Interceptor CR在ClusterLogConfig/LogConfig中使用sinkRef/interceptorRef进行引用。

View File

@ -278,6 +278,7 @@
| timestamp.convert[n].fromLayout | string | 必填 | 无 | 指定字段的时间格式(golang形式) |
| timestamp.convert[n].toLayout | string | 必填 | 无 | 转换后的时间格式(golang形式),另外可为`unix`和`unix_ms` |
| timestamp.convert[n].toType | string | 非必填 | 无 | 转换后的时间字段类型 |
| timestamp.convert[n].local | bool | 非必填 | false | 是否将解析的时间转成当前时区 |
!!! example
```yaml
@ -316,7 +317,23 @@ const (
```
还可以根据实际情况修改。
### fmt
字段内容重新格式化。可根据其他字段内容进行组合和格式化。
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |
| ---------- | ----------- | ----------- | --------- | -------- |
| fmt.fields | map | 必填 | 无 | key表示需要格式化的字段名称value为需要格式化的内容。可使用`${}`的方式表示取值某个字段 |
!!! example
```yaml
interceptors:
- type: normalize
processors:
- fmt:
fields:
d: new-${a.b}-${c}
```

View File

@ -50,7 +50,7 @@
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |
| ---------- | ----------- | ----------- | --------- | -------- |
| sniff | bool | 非必填 | true | 是否开启sniffer |
| sniff | bool | 非必填 | false | 是否开启sniffer |
## gzip
@ -58,5 +58,9 @@
| ---------- | ----------- | ----------- | --------- | -------- |
| gzip | bool | 非必填 | false | 发送数据是否开启gzip压缩 |
## documentId
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |
| ---------- | ----------- | ----------- | --------- | -------- |
| documentId | string | 非必填 | | 发送至elasticsearch的id值可使用`${}`的方式取某个字段 |

View File

@ -0,0 +1,39 @@
# loki
loki sink用于发送数据至Loki存储。Loki文档可参考[这里](https://grafana.com/docs/loki/latest/)。
!!! example
```yaml
sink:
type: loki
url: "http://localhost:3100/loki/api/v1/push"
```
## url
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |
| ---------- | ----------- | ----------- | --------- | -------- |
| url | string | 必填 | | push loki的api |
## tenantId
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |
| ---------- | ----------- | ----------- | --------- | -------- |
| tenantId | string | 非必填 | | 发送使用的租户名称 |
## timeout
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |
| ---------- | ----------- | ----------- | --------- | -------- |
| timeout | time.Duration | 非必填 | 30s | 发送的超时时间 |
## entryLine
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |
| ---------- | ----------- | ----------- | --------- | -------- |
| entryLine | string | 非必填 | | 发送至Loki的日志内容默认为loggie event的body |
Loki的日志数据结构大概分为label和主体数据loggie会默认将header里的元信息字段转成以下划线`_`连接的label。

View File

@ -34,3 +34,16 @@
| ---------- | ----------- | ----------- | --------- | -------- |
| codec.pretty | | 非必填 | false | 是否进行json格式美化 |
| codec.beatsFormat | | 非必填 | false | 日志转成类filebeats格式增加`@timestamp`字段同时body字段命名为`message` |
#### type: raw
用于发送采集的原始body数据。
!!! example
```yaml
sink:
type: dev
codec:
type: raw
```

View File

@ -34,7 +34,6 @@ file source用于日志采集。
- /tmp/loggie/**/access.log{,.[2-9][0-9][0-9][0-9]-[01][0-9]-[0123][0-9]}
```
###
## excludeFiles
@ -54,6 +53,30 @@ file source用于日志采集。
| ------------- | ------ | ---------- | -------- | -------------------------------- |
| ignoreSymlink | bool | 非必填 | false | 是否忽略符号链接(软链接)的文件 |
## addonMeta
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |
| ------------- | ------ | ---------- | -------- | -------------------------------- |
| addonMeta | bool | 非必填 | false | 是否添加默认的日志采集state元信息 |
!!! example "event示例"
```json
{
"body": "this is test",
"state": {
"pipeline": "local",
"source": "demo",
"filename": "/var/log/a.log",
"timestamp": "2006-01-02T15:04:05.000Z",
"offset": 1024,
"bytes": 4096,
"hostname": "node-1"
}
}
```
## workerCount
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |

View File

@ -29,4 +29,18 @@
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |
| ---------- | ----------- | ----------- | --------- | -------- |
| bufferSize | int | 非必填 | 1000 | 监听的队列大小最小为1 |
| bufferSize | int | 非必填 | 1000 | 监听的队列大小最小为1 |
## watchLatestEvents
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |
| ---------- | ----------- | ----------- | --------- | -------- |
| watchLatestEvents | bool | 非必填 | false | 是否只监听最新的events |
由于Loggie重启后会重新list所有的events会导致重复发送如果不希望重复发送可以设置为true当然可能导致重启时间段内新产生的events丢失。
## blackListNamespaces
| `字段` | `类型` | `是否必填` | `默认值` | `含义` |
| ---------- | ----------- | ----------- | --------- | -------- |
| blackListNamespaces | string数组 | 非必填 | | 不接收其中定义的namespaces中产生的events |

View File

@ -66,6 +66,7 @@ nav:
- Overview: reference/pipelines/sink/overview.md
- elasticsearch: reference/pipelines/sink/elasticsearch.md
- kafka: reference/pipelines/sink/kafka.md
- loki: reference/pipelines/sink/loki.md
- grpc: reference/pipelines/sink/grpc.md
- file: reference/pipelines/sink/file.md
- dev: reference/pipelines/sink/dev.md