diff --git a/monitoring/logging/fluentd/introduction/configurations/file-fluent.conf b/monitoring/logging/fluentd/introduction/configurations/file-fluent.conf
new file mode 100644
index 0000000..e69de29
diff --git a/monitoring/logging/fluentd/introduction/configurations/fluent.conf b/monitoring/logging/fluentd/introduction/configurations/fluent.conf
new file mode 100644
index 0000000..035fae0
--- /dev/null
+++ b/monitoring/logging/fluentd/introduction/configurations/fluent.conf
@@ -0,0 +1,46 @@
+# This source reads tail of a file
+
+ @type tail
+ format json
+ read_from_head true
+ tag file-myapp.log
+ path /app/example-log.log
+ pos_file /tmp/example-log.log.pos
+
+
+
+ @type record_transformer
+
+ host_param "#{Socket.gethostname}"
+
+
+
+
+ @type file
+ path /output/file-myapp.log
+
+
+################################################################
+
+# This source gets incoming logs over HTTP
+
+ @type http
+ port 9880
+ bind 0.0.0.0
+ body_size_limit 32m
+ keepalive_timeout 10s
+
+
+
+ @type record_transformer
+
+ host_param "#{Socket.gethostname}"
+
+
+
+
+ @type file
+ path /output/http.log
+
+
+################################################################
\ No newline at end of file
diff --git a/monitoring/logging/fluentd/introduction/configurations/http-fluent.conf b/monitoring/logging/fluentd/introduction/configurations/http-fluent.conf
new file mode 100644
index 0000000..e69de29
diff --git a/monitoring/logging/fluentd/introduction/docker-compose.yaml b/monitoring/logging/fluentd/introduction/docker-compose.yaml
index 7ec14f0..7eb3e3b 100644
--- a/monitoring/logging/fluentd/introduction/docker-compose.yaml
+++ b/monitoring/logging/fluentd/introduction/docker-compose.yaml
@@ -5,8 +5,24 @@ services:
user: root
image: fluent/fluentd:v1.11-debian
volumes:
- - /var/lib/docker/containers:/fluentd/log/containers
- - ./fluent.conf:/fluentd/etc/fluent.conf
+ - /var/lib/docker/containers:/fluentd/log/containers # Example: Reading docker logs
+ - ./file:/app/ #Example: Reading logs from a file
+ - ./configurations:/fluentd/etc/
- ./logs:/output/
logging:
- driver: "local"
\ No newline at end of file
+ driver: "local"
+ # This app sends logs to Fluentd via HTTP
+ http-myapp:
+ container_name: http-myapp
+ image: alpine
+ volumes:
+ - ./http:/app
+ command: [ /bin/sh , -c , "apk add --no-cache curl && chmod +x /app/send-http-log.sh && ./app/send-http-log.sh"]
+ # This app writes logs to a local file
+ file-myapp:
+ container_name: file-myapp
+ image: alpine
+ volumes:
+ - ./file:/app
+ command: [ /bin/sh , -c , "apk add --no-cache curl && chmod +x /app/write-file-log.sh && ./app/write-file-log.sh"]
+
diff --git a/monitoring/logging/fluentd/introduction/file/example-log.log b/monitoring/logging/fluentd/introduction/file/example-log.log
new file mode 100644
index 0000000..0aa7037
--- /dev/null
+++ b/monitoring/logging/fluentd/introduction/file/example-log.log
@@ -0,0 +1 @@
+This is a log
diff --git a/monitoring/logging/fluentd/introduction/file/write-file-log.sh b/monitoring/logging/fluentd/introduction/file/write-file-log.sh
new file mode 100644
index 0000000..ab7a3a4
--- /dev/null
+++ b/monitoring/logging/fluentd/introduction/file/write-file-log.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+while true
+do
+ echo "Writing log to a file"
+ echo '{"app":"file-myapp"}' >> /app/example-log.log
+ sleep 5
+done
\ No newline at end of file
diff --git a/monitoring/logging/fluentd/introduction/fluent.conf b/monitoring/logging/fluentd/introduction/fluent.conf
deleted file mode 100644
index ffb1def..0000000
--- a/monitoring/logging/fluentd/introduction/fluent.conf
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- @type tail
- format json
- read_from_head true
- tag docker.logs
- path /fluentd/log/containers/*/*-json.log
- pos_file /tmp/container-logs.pos
-
-
-
- @type file
- path /output/test.log
-
diff --git a/monitoring/logging/fluentd/introduction/http/send-http-log.sh b/monitoring/logging/fluentd/introduction/http/send-http-log.sh
new file mode 100644
index 0000000..4a42eb0
--- /dev/null
+++ b/monitoring/logging/fluentd/introduction/http/send-http-log.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+while true
+do
+ echo "Sending logs to FluentD"
+ curl -X POST -d 'json={"foo":"bar"}' http://fluentd:9880/http-myapp.log
+ sleep 5
+done
\ No newline at end of file
diff --git a/monitoring/logging/fluentd/introduction/logs/readme.txt b/monitoring/logging/fluentd/introduction/logs/readme.txt
new file mode 100644
index 0000000..07181fd
--- /dev/null
+++ b/monitoring/logging/fluentd/introduction/logs/readme.txt
@@ -0,0 +1,2 @@
+fluentd will collect all container logs and write them
+in this folder
\ No newline at end of file