Fluent Bit 中文文档
  • Fluent Bit 中文文档
  • 关于
    • Fluent Bit 是什么?
    • Fluent Bit 简要历史
    • Fluentd & Fluent Bit
    • 协议
  • 概念
    • 核心概念
    • 缓冲
    • 数据管道
      • 输入
      • 解析器
      • 过滤器
      • 缓冲
      • 路由
      • 输出
  • 安装
    • 升级说明
    • 平台支持
    • 依赖
    • 源码安装
      • 下载源码
      • 构建和安装
      • 以静态配置构建
    • Linux 软件包
      • Amazon Linux
      • Redhat / CentOS
      • Debian
      • Ubuntu
      • 树莓派
    • Docker
    • Kubernetes
    • Windows
  • 管理
    • 配置 Fluent Bit
      • 格式与模式
      • 配置文件
      • 变量
      • 命令
      • 上游服务负载均衡
      • 单位
    • 安全性
    • 缓冲与存储
    • 积压
    • 调度与重试
    • 内存管理
    • 监控
    • 内部状态导出/信号
  • 数据管道
    • 输入插件
      • Dummy
      • Memory Metics
      • Standard Input
      • Systemd
      • tail
    • 解析器
      • JSON
      • Regular Expression
      • LTSV
      • Logfmt
    • 过滤器
      • Grep
      • Kubernetes
      • Rewrite Tag
      • Modify
      • Nest
    • 输出插件
      • Counter
      • Elasticsearch
      • File
      • FlowCounter
      • HTTP
      • Kafka
      • NULL
      • PostgreSQL
      • Standard Output
      • TCP & TLS
  • 流处理
    • 简介
    • 总览
    • 快速开始
      • Fluent Bit + SQL
      • Check Keys and NULL values
      • Hands On! 101
  • FLUENT BIT FOR DEVELOPERS
    • C Library API
    • 手动提取记录
    • Golang 输出插件
Powered by GitBook
On this page
  • Configuration Parameters
  • Format
  • out_file format
  • plain format
  • csv format
  • ltsv format
  • template format
  • Getting Started
  • Command Line
  • Configuration File

Was this helpful?

  1. 数据管道
  2. 输出插件

File

file 输出插件可以将通过输入插件接收的数据写入到文件中。

Configuration Parameters

该插件支持以下配置参数:

Key

Description

Path

输出文件路径。如果未设置,则输出文件名为标签名称

Format

Format

out_file format

out_file 格式输出 time(时间),tag(标签) 及 JSON 格式的记录。out_file 格式没有配置参数。

tag: [time, {"key1":"value1", "key2":"value2", "key3":"value3"}]

plain format

plain 格式输出 JSON 格式的记录(没有额外的 tag(标签) and timestamp(时间戳) 字段)。plain 格式没有配置参数。

{"key1":"value1", "key2":"value2", "key3":"value3"}

csv format

csv 格式输出 csv 格式的记录。csv 格式支持一个额外的配置参数:

Key

Description

Delimiter

数据的分隔符。默认值为 ,

time[delimiter]"value1"[delimiter]"value2"[delimiter]"value3"

ltsv format

ltsv 格式将记录输出为 LTSV 格式。LTSV 支持额外的配置参数:

Key

Description

Delimiter

数据的分隔符。默认为 \t(TAB)

Label_Delimiter

标签与值的分隔符。默认为 :

field1[label_delimiter]value1[delimiter]field2[label_delimiter]value2\n

template format

template 使用自定义格式输出记录。

Key

Description

Template

格式化的字符串。默认值为 {time} {message}

template 接受格式模板,并使用记录中的值填充相应的占位符。

例如,如果您按如下所示内容进行配置:

[INPUT]
  Name mem

[OUTPUT]
  Name file
  Format template
  Template {time} used={Mem.used} free={Mem.free} total={Mem.total}

你将得到如下输出:

1564462620.000254 used=1045448 free=31760160 total=32805608

Getting Started

您可以从命令行或通过配置文件运行插件:

Command Line

在命令行中,您可以使用以下内容让 Fluent Bit 对数据进行收集:

$ fluent-bit -i cpu -o file -p path=output.txt

Configuration File

在您的主配置文件中,添加以下 Input 和 Output 配置段:

[INPUT]
    Name cpu
    Tag  cpu

[OUTPUT]
    Name file
    Match *
    Path output.txt
PreviousElasticsearchNextFlowCounter

Last updated 5 years ago

Was this helpful?

文件内容的格式。另请参阅 部分。默认值: out_file

Format