1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-31 06:18:07 +00:00

create fluentd test

This commit is contained in:
Nebel 2021-03-31 15:44:14 +09:00
parent 064d41760e
commit 0f19aab532
5 changed files with 120 additions and 0 deletions

View file

@ -0,0 +1,8 @@
version: "3"
services:
fluentd:
image: fluent/fluentd:edge
ports: ["24224:24224"]
volumes:
- "./log:/fluentd/log"
- "./fluent.conf:/fluentd/etc/fluent.conf"

37
fluentd/fluent.conf Normal file
View file

@ -0,0 +1,37 @@
<system>
enable_msgpack_time_support true
</system>
<source>
@type forward
@id input1
@label @mainstream
port 24224
</source>
<filter **>
@type stdout
</filter>
<label @mainstream>
<match docker.**>
@type file
@id output_docker1
path /fluentd/log/docker.*.log
symlink_path /fluentd/log/docker.log
append true
time_slice_format %Y%m%d
time_slice_wait 1m
time_format %Y%m%dT%H%M%S%z
</match>
<match **>
@type file
@id output1
path /fluentd/log/data.*.log
symlink_path /fluentd/log/data.log
append true
time_slice_format %Y%m%d
time_slice_wait 10m
time_format %Y%m%dT%H%M%S%z
</match>
</label>

25
fluentd/index.js Normal file
View file

@ -0,0 +1,25 @@
import msgpack from "msgpack-lite";
import fetch from "node-fetch";
const body = msgpack.encode({
int: 1,
float: 0.5,
// date: new Date(),
// error: new Error(),
// num: new Number(0),
buff: Buffer.from([1, 2]),
// arrbuff: Uint32Array.from([3, 4]),
// dataView: new ArrayBuffer([1]),
array: [2, 3],
object: { key: "val" },
str: new String("hello"),
// bool: new Boolean(true),
// intArray: new Int8Array(),
// bigInt: 1n,
});
const res = await fetch("http://localhost:24224/", {
method: "POST",
headers: { "Content-type": "application/msgpack" },
body,
});
console.log(res);

12
fluentd/package.json Normal file
View file

@ -0,0 +1,12 @@
{
"name": "fluentd",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"author": "Kohei Watanabe <kou029w@gmail.com>",
"license": "MIT",
"dependencies": {
"msgpack-lite": "^0.1.26",
"node-fetch": "^2.6.1"
}
}

38
fluentd/yarn.lock Normal file
View file

@ -0,0 +1,38 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
event-lite@^0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/event-lite/-/event-lite-0.1.2.tgz#838a3e0fdddef8cc90f128006c8e55a4e4e4c11b"
integrity sha512-HnSYx1BsJ87/p6swwzv+2v6B4X+uxUteoDfRxsAb1S1BePzQqOLevVmkdA15GHJVd9A9Ok6wygUR18Hu0YeV9g==
ieee754@^1.1.8:
version "1.2.1"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
int64-buffer@^0.1.9:
version "0.1.10"
resolved "https://registry.yarnpkg.com/int64-buffer/-/int64-buffer-0.1.10.tgz#277b228a87d95ad777d07c13832022406a473423"
integrity sha1-J3siiofZWtd30HwTgyAiQGpHNCM=
isarray@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
msgpack-lite@^0.1.26:
version "0.1.26"
resolved "https://registry.yarnpkg.com/msgpack-lite/-/msgpack-lite-0.1.26.tgz#dd3c50b26f059f25e7edee3644418358e2a9ad89"
integrity sha1-3TxQsm8FnyXn7e42REGDWOKprYk=
dependencies:
event-lite "^0.1.1"
ieee754 "^1.1.8"
int64-buffer "^0.1.9"
isarray "^1.0.0"
node-fetch@^2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==