Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
update fluent-bit README.md file reference to the config

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
  • Loading branch information
YANG-DB committed Jun 2, 2023
1 parent cc5e580 commit e2359d5
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions src/fluent-bit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,8 @@ For setting up a fluent-bit agent on Nginx, please follow the next instructions

- Install Fluent-bit on the Nginx server. You can download the latest package from the official Fluent-bit website or use your package manager to install it.

- Once Fluent-bit is installed, create a configuration file named fluent-bit.conf in the /etc/fluent-bit/ directory. Add the following configuration to the file:
- Once Fluent-bit is installed, create a configuration file named [fluent-bit.conf](fluent-bit.conf) in the /etc/fluent-bit/ directory. Add the following configuration to the file:

```text
[SERVICE]
Flush 1
Log_Level info
Parsers_File parsers.conf
[Filter]
Name lua
Match *
code function cb_filter(a,b,c)local d={}local e=os.date("!%Y-%m-%dT%H:%M:%S.000Z")d["observerTime"]=e;d["body"]=c.remote.." "..c.host.." "..c.user.." ["..os.date("%d/%b/%Y:%H:%M:%S %z").."] \""..c.method.." "..c.path.." HTTP/1.1\" "..c.code.." "..c.size.." \""..c.referer.."\" \""..c.agent.."\""d["trace_id"]="102981ABCD2901"d["span_id"]="abcdef1010"d["attributes"]={}d["attributes"]["data_stream"]={}d["attributes"]["data_stream"]["dataset"]="nginx.access"d["attributes"]["data_stream"]["namespace"]="production"d["attributes"]["data_stream"]["type"]="logs"d["event"]={}d["event"]["category"]={"web"}d["event"]["name"]="access"d["event"]["domain"]="nginx.access"d["event"]["kind"]="event"d["event"]["result"]="success"d["event"]["type"]={"access"}d["http"]={}d["http"]["request"]={}d["http"]["request"]["method"]=c.method;d["http"]["response"]={}d["http"]["response"]["bytes"]=tonumber(c.size)d["http"]["response"]["status_code"]=c.code;d["http"]["flavor"]="1.1"d["http"]["url"]=c.path;d["communication"]={}d["communication"]["source"]={}d["communication"]["source"]["address"]="127.0.0.1"d["communication"]["source"]["ip"]=c.remote;return 1,b,d end
call cb_filter
[INPUT]
Name tail
Path /var/log/nginx/access.log
Tag nginx.access
DB /var/log/flb_input.access.db
Mem_Buf_Limit 5MB
Skip_Long_Lines On
[OUTPUT]
Name opensearch
Match nginx.*
Host <OSS_HOST>
Port <OSS_PORT>
Index sso_nginx-access-%Y.%m.%d
```
Here, we specify the input plugin as tail, set the path to the Nginx access log file, and specify a tag to identify the logs in Fluent-bit. We also set some additional parameters such as memory buffer limit and skipping long lines.

For the output, we use the `opensearch` plugin to send the logs to Opensearch. We specify the Opensearch host, port, and index name.
Expand All @@ -62,4 +35,4 @@ sudo systemctl start fluent-bit
- Verify that Fluent-bit is running by checking its status:
```text
sudo systemctl status fluent-bit
```
```

0 comments on commit e2359d5

Please sign in to comment.