.. _monitoring: Monitoring ========== The stack used to visualize the logs generated by nflux is **OpenSearch**. To set up your own logging stack, follow the steps below: Setting up the OpenSearch Stack ------------------------------- 1. **Clone the repository:** .. code-block:: bash git clone https://github.com/containerscrew/nflux.git 2. **Adjust system settings (Linux):** .. code-block:: bash sudo sysctl -w vm.max_map_count=262144 3. **Navigate to the infrastructure directory:** .. code-block:: bash cd nflux/infra 4. **Copy the environment file:** .. code-block:: bash cp .env.example .env 5. **Generate a password for the OpenSearch admin user:** You must generate a secure password for the OpenSearch administrator user. .. code-block:: bash pwgen -s -y 16 1 6. **Edit the .env file:** Use the password generated in the previous step to update the relevant fields in the ``.env`` file. 7. Download the required geoip database: You need to download the GeoLite2 City database from MaxMind to enable geolocation features in Fluent Bit. .. code-block:: bash wget https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb -O ./geoip/GeoLite2-City.mmdb 8. **Start the stack:** Use the appropriate command depending on your container engine (Podman or Docker). .. code-block:: bash podman-compose -f monitoring.yml up -d *Alternatively, use `docker-compose -f monitoring.yml up -d` if you are using Docker.* 9. **Open the dev tools in OpenSearch Dashboards and run the following command to create an index template mapping:** .. code-block:: bash PUT _index_template/node-geo-template { "index_patterns": ["nflux*"], "template": { "mappings": { "properties": { "location": { "type": "geo_point" } } } } } GET nflux-*/_mapping DELETE nflux-* 10. **Create the index pattern in OpenSearch Dashboards:** - Visit the official Opensearch documentation to create an index pattern: `Creating index patterns `_.