A complete logging and observability stack using OpenSearch, Data Prepper, and Fluent Bit for processing and analyzing Nginx logs in real-time.
This project provides a production-ready logging infrastructure that includes:
- Multi-node OpenSearch cluster for scalable log storage
- OpenSearch Dashboards for log visualization and analysis
- Data Prepper for log transformation and enrichment
- Fluent Bit for efficient log collection
- Pre-configured Nginx log parsing and structuring
Nginx Logs → Fluent Bit → Data Prepper → OpenSearch → OpenSearch Dashboards
(Source) (Collector) (Transformer) (Storage) (Visualization)
- Docker Engine 20.10.0+
- Docker Compose v2.0.0+
- At least 4GB of available RAM
- Nginx installed on the host machine
- Clone the repository:
git clone https://github.com/yourusername/opensearch-fluent-observability.git
cd opensearch-fluent-observability
- Create required directories:
mkdir -p config
- Copy configuration files:
cp config-examples/data-prepper.yaml config/
cp config-examples/fluent-bit.conf config/
- Start the stack:
docker-compose up -d
- Check the OpenSearch cluster health:
curl http://localhost:9200/_cluster/health
- Access OpenSearch Dashboards:
- URL: http://localhost:5601
- Default credentials:
- Username: admin
- Password: Anubhav@321
├── docker-compose.yml # Main compose file for all services
├── config/
│ ├── data-prepper.yaml # Data Prepper pipeline configuration
│ └── fluent-bit.conf # Fluent Bit configuration
├── config-examples/ # Example configurations
└── README.md
- 2-node cluster setup
- Security plugin disabled for development
- 512MB heap size per node
- Persistent volume storage
- HTTP source on port 2021
- Grok processor for Nginx log parsing
- Daily index rotation
- Bulk processing with retry logic
- Tail input plugin for Nginx logs
- Custom parser for Nginx log format
- Gzip compression
- Automatic retry mechanism
Processed logs include:
- Client IP
- Timestamp
- HTTP Method
- URL
- Response Code
- User Agent
- Additional metadata (hostname, environment)
Backup the OpenSearch data volumes:
docker run --rm -v opensearch-data1:/data -v $(pwd):/backup alpine tar czf /backup/opensearch-data1.tar.gz /data
To add more OpenSearch nodes:
- Copy the node configuration in docker-compose.yml
- Update the discovery.seed_hosts
- Add the new node to OPENSEARCH_HOSTS in dashboard configuration
Default security measures:
- Basic authentication enabled
- SSL/TLS disabled for development (enable for production)
- Default admin password configured
Common issues and solutions:
-
OpenSearch fails to start:
- Check ulimit settings
- Verify memory settings
- Review logs:
docker-compose logs opensearch-node1
-
No logs appearing:
- Verify Nginx is generating logs
- Check Fluent Bit configuration
- Review Data Prepper pipeline status
MIT License - see LICENSE file for details.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
- OpenSearch Project contributors
- Fluent Bit maintainers
- Data Prepper team
Created and maintained by [@mranv]# opensearch-fluent-observability