Skip to content

Commit 14e0a04

Browse files
committed
wip
1 parent fdf927d commit 14e0a04

File tree

9 files changed

+163
-24
lines changed

9 files changed

+163
-24
lines changed

fluentbit/docker-compose.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,28 @@ services:
88
context: log-generator
99
volumes:
1010
- logs:/logs
11+
develop:
12+
watch:
13+
- action: sync+restart
14+
path: ./logs
15+
target: /logs
1116

1217
fluentbit:
1318
container_name: fluentbit
1419
image: fluent/fluent-bit:latest
1520
user: root
1621
volumes:
1722
- logs:/logs
18-
- ./fluentbit/fluent-bit.conf:/fluent-bit/fluent-bit.conf
23+
- ./fluentbit/fluent-bit.yaml:/fluent-bit/fluent-bit.yaml
24+
develop:
25+
watch:
26+
- action: sync+restart
27+
path: ./fluentbit/fluent-bit.yaml
28+
target: /fluent-bit/fluent-bit.yaml
1929
command:
2030
- "fluent-bit"
2131
- "-c"
22-
- "/fluent-bit/fluent-bit.conf"
32+
- "/fluent-bit/fluent-bit.yaml"
2333

2434
http-server:
2535
container_name: http-server

fluentbit/fluentbit/fluent-bit.conf

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# service:
2+
# flush: 1
3+
# log_level: info
4+
# storage:
5+
# path: /logs/fluent-bit-storage
6+
# sync: full
7+
8+
pipeline:
9+
inputs:
10+
- name: tail
11+
path: /logs/*.log
12+
storage:
13+
type: filesystem
14+
processors:
15+
logs:
16+
- name: modify
17+
copy: log log_hash
18+
- name: content_modifier
19+
action: hash
20+
key: log_hash
21+
outputs:
22+
- name: http
23+
match: "*"
24+
host: http-server
25+
port: 5000
26+
uri: /logs
27+
format: json
28+
retry_limit: false
29+
- name: stdout
30+
match: "*"

opensearch/mininal/README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# lab-opensearch
2+
3+
Lab created to test configuration Filebeat, Logstash, and OpenSearch and OpenSearch stack.
4+
5+
- **Filebeat**: The Filebeat reads the logs line of this file [minimal-lab/filebeat/log/fake-logs.log](mininal-lab/filebeat/log/fake-logs.log) and sends to Logstash;
6+
- **Logstash**: Receive logs of the filebeat and parse them and forward to OpenSearch;
7+
- **OpenSearch**: Reveive logs (that in this step, are been named of *Documents*), and stores them in the OpenSearch internal database;
8+
- **OpenSearch-Dashboards**: Connects in the OpenSearch database through web API and provides friendly web UI console to search de logs/documents.
9+
10+
> :warning: Study and Development's purposes
11+
>> The tool's configuration does not have SSL or authentication plugins enabled.
12+
>> This lab was created to test purposes only, don't apply it in your production infrastructure.
13+
14+
Project directory layout:
15+
16+
```bash
17+
├── docker-compose.yml # containers config state
18+
├── filebeat # filebeat container files
19+
│ ├── Dockerfile # filebeat dockerfile
20+
│ ├── filebeat.yml # filebeat main config file
21+
│ └── log # fake log directory (shared like docker volume)
22+
│ └── *.log # fake logs
23+
├── logstash # logstash container file
24+
│ ├── config # logstash config directory
25+
│ │ ├── logstash.yml # logstash main config file
26+
│ │ └── pipelines.yml # pipelines manifest file
27+
│ ├── Dockerfile # logstash Dockerfile
28+
│ └── pipeline # pipeline directory
29+
│ └── pipeline-1.cfg # pipeline source code
30+
├── opensearch # opensearch container config files
31+
│ ├── Dockerfile # opensearch Dockerfile
32+
│ └── opensearch.yml # opensearch main config file
33+
└── opensearch-dashboards # opensearch-dashboards container config files
34+
├── Dockerfile # opensearch-dashboards Dockerfile
35+
└── opensearch_dashboards.yml # opensearch-dashboards main config file
36+
```
37+
38+
## How To Run
39+
40+
The lab was created to run over `docker`. To set up container configuration use `docker-compose`.
41+
42+
- To start the environment:
43+
44+
```bash
45+
$ docker-compose up --build -d
46+
```
47+
48+
- To check logs:
49+
50+
```bash
51+
$ docker-compose logs
52+
```
53+
54+
- To destroy stack:
55+
56+
```bash
57+
$ docker-compose logs
58+
```
59+
60+
## How to Access the OpenSearch
61+
62+
The resources can be accessed with the following links:
63+
64+
- OpenSearch Dashboards: http://127.0.0.1:5601/
65+
- OpenSearch: http://127.0.0.1:9200/
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: "3.7"
2+
3+
services:
4+
opensearch:
5+
container_name: opensearch
6+
build:
7+
context: opensearch/
8+
args:
9+
TAG_VERSION: "3.0.0"
10+
volumes:
11+
- type: bind
12+
source: ./opensearch/opensearch.yml
13+
target: /usr/share/opensearch/config/opensearch.yml
14+
ports:
15+
- 9200:9200
16+
environment:
17+
TIMEZONE: America/Sao_Paulo
18+
TZ: America/Sao_Paulo
19+
OPENSEARCH_JAVA_OPTS: -Xms512m -Xmx512m
20+
21+
opensearch-dashboards:
22+
container_name: opensearch-dashboards
23+
build:
24+
context: opensearch-dashboards/
25+
args:
26+
TAG_VERSION: "3.0.0"
27+
volumes:
28+
- type: bind
29+
source: ./opensearch-dashboards/opensearch_dashboards.yml
30+
target: /usr/share/opensearch-dashboards/config/opensearch_dashboards.yml
31+
read_only: true
32+
ports:
33+
- 5601:5601
34+
environment:
35+
TIMEZONE: America/Sao_Paulo
36+
TZ: America/Sao_Paulo
37+
LS_JAVA_OPTS: "-Xmx1g -Xms256m"
38+
depends_on:
39+
- opensearch
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ARG TAG_VERSION
2+
FROM opensearchproject/opensearch-dashboards:${TAG_VERSION}
3+
RUN /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin remove securityDashboards
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/config/opensearch_dashboards.yml
2+
3+
server.port: 5601
4+
server.host: "0.0.0.0"
5+
server.ssl.enabled: false
6+
7+
opensearch.hosts: ["http://opensearch:9200"]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ARG TAG_VERSION
2+
FROM opensearchproject/opensearch:${TAG_VERSION}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
cluster.name: docker-cluster
2+
discovery.type: single-node
3+
network.host: 0.0.0.0
4+
5+
plugins.security.disabled: true

0 commit comments

Comments
 (0)