Last updated 1 year ago
下载预编译的iLogtail包,解压后进入目录,该目录下文均称为部署目录。
对iLogtail进行配置
部署目录中ilogtail_config.json是iLogtail的系统参数配置文件,config/local是iLogtail的本地采集配置目录。
ilogtail_config.json
config/local
这里我们在采集配置目录中创建file_simple.yaml文件,配置采集当前目录simple.log文件并输出到标准输出:
file_simple.yaml
您也可以直接从下面的地址下载示例配置。
后台启动iLogtail
以上命令将标准输出重定向到stdout.log以便观察。
构造示例日志
查看采集到的文件日志
结果为
了解采集配置结构:
参考更多可组合的日志采集和处理配置样例:
wget https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/latest/ilogtail-latest.linux-amd64.tar.gz tar -xzvf ilogtail-latest.linux-amd64.tar.gz cd ilogtail-<version>
enable: true inputs: - Type: input_file # 文件输入类型 FilePaths: - ./simple.log flushers: - Type: flusher_stdout # 标准输出流输出类型 OnlyStdout: true
cd ./config/local wget https://raw.githubusercontent.com/alibaba/ilogtail/main/example_config/quick_start/config/file_simple.yaml cd -
nohup ./ilogtail > stdout.log 2> stderr.log &
echo 'Hello, iLogtail!' >> simple.log
cat stdout.log
2022-07-15 00:20:29 {"__tag__:__path__":"./simple.log","content":"Hello, iLogtail!","__time__":"1657815627"}