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

Was this helpful?

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

Standard Input

PreviousMemory MeticsNextSystemd

Last updated 4 years ago

Was this helpful?

stdin 标准输入插件允许通过标准输入接口(stdin)检索有效的 JSON 文本消息。要使用它,请指定插件名称作为输入,例如:

$ fluent-bit -i stdin -o stdout

stdin 插件可以识别以下 JSON 数据格式的输入数据:

1. { map => val, map => val, map => val }
2. [ time, { map => val, map => val, map => val } ]

如下是一个更好的示例演示它是如何工作的,通过一个 Bash 脚本生成消息并将其写入 。 将以下内容写入名为 test.sh 的文件中:

#!/bin/sh

while :; do
  echo -n "{\"key\": \"some value\"}"
  sleep 1
done

授予脚本执行权限:

$ chmod 755 test.sh

现在,通过以下方式启动脚本和 :

$ ./test.sh | fluent-bit -i stdin -o stdout
Fluent Bit v1.x.x
* Copyright (C) 2019-2020 The Fluent Bit Authors
* Copyright (C) 2015-2018 Treasure Data
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2016/10/07 21:44:46] [ info] [engine] started
[0] stdin.0: [1475898286, {"key"=>"some value"}]
[1] stdin.0: [1475898287, {"key"=>"some value"}]
[2] stdin.0: [1475898288, {"key"=>"some value"}]
[3] stdin.0: [1475898289, {"key"=>"some value"}]
[4] stdin.0: [1475898290, {"key"=>"some value"}]
Fluent Bit
Fluent Bit