# sadsfae/ansible-elk architecture

> Architecture diagram of the GitHub repository sadsfae/ansible-elk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sadsfae/ansible-elk
- Repository: https://github.com/sadsfae/ansible-elk

## Overview

##### Main Components

a) Server-side Components:
- Elasticsearch (Core Database)
- Logstash/Fluentd (Log Processing)
- Kibana (Visualization Interface)
- Nginx/Apache (Reverse Proxy)
- X-Pack (Optional Security Layer)
- Curator (Optional Index Management)

b) Client-side Components:
- Filebeat (Log Shipping)
- Metricbeat (System Metrics)
- Packetbeat (Network Data)
- Heartbeat (Uptime Monitoring)

**[Client Layer]**
- ↑
**[Transport Layer]**
- ↑
**[Processing Layer]**
- ↑
**[Storage Layer]**
- ↑
**[Visualization Layer]**

##### Key Elements

a) Data Flow:
- Log data flow from clients to server
- SSL/TLS encryption paths
- Ports for different services (configurable in group_vars/all.yml)

b) Component Relationships:
- Client-Server communication
- Internal component dependencies
- Authentication flows

##### Specific Implementation Details

- Nginx/Apache reverse proxy (port 80/8080) → Kibana
- Filebeat → Logstash/Fluentd (SSL-encrypted)
- Elasticsearch cluster configuration
- X-Pack security wrapper (if enabled)
- Curator maintenance workflows
- Alternative paths for Fluentd vs Logstash

##### Component Grouping

Related components:
**[ELK Server Group]**
- Elasticsearch (Storage)
- Logstash/Fluentd (Processing)
- Kibana (UI)
- Nginx/Apache (Proxy)
- X-Pack (Security)
- Curator (Maintenance)

**[Client Group]**
- Filebeat
- Metricbeat
- Packetbeat
- Heartbeat
- RSyslog (if using Fluentd)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Layer"]
        direction TB
        FB["Filebeat"]:::client
        MB["Metricbeat"]:::client
        PB["Packetbeat"]:::client
        HB["Heartbeat"]:::client
        RS["RSyslog"]:::client
    end

    subgraph Transport["Transport Layer"]
        direction TB
        SSL["SSL/TLS Encryption"]:::security
        FW["Firewall Rules"]:::security
    end

    subgraph Processing["Processing Layer"]
        direction TB
        LS["Logstash"]:::processing
        FD["Fluentd"]:::processing
    end

    subgraph Storage["Storage Layer"]
        direction TB
        ES["Elasticsearch"]:::storage
        CUR["Curator"]:::maintenance
    end

    subgraph Visualization["Visualization Layer"]
        direction TB
        KB["Kibana"]:::ui
        NX["Nginx"]:::proxy
        AP["Apache"]:::proxy
        XP["X-Pack"]:::security
    end

    %% Data Flow Connections
    FB --> SSL
    MB --> SSL
    PB --> SSL
    HB --> SSL
    RS --> SSL

    SSL --> LS
    SSL --> FD
    FW --> LS
    FW --> FD

    LS --> ES
    FD --> ES
    
    ES --> KB
    KB --> NX
    KB --> AP
    XP -.- KB
    XP -.- ES
    CUR --> ES

    %% Click Events
    click FB "https://github.com/sadsfae/ansible-elk/tree/master/install/roles/filebeat/"
    click MB "https://github.com/sadsfae/ansible-elk/tree/master/install/roles/metricbeat/"
    click PB "https://github.com/sadsfae/ansible-elk/tree/master/install/roles/packetbeat/"
    click HB "https://github.com/sadsfae/ansible-elk/tree/master/install/roles/heartbeat/"
    click FW "https://github.com/sadsfae/ansible-elk/tree/master/install/roles/firewall/"
    click LS "https://github.com/sadsfae/ansible-elk/tree/master/install/roles/logstash/"
    click FD "https://github.com/sadsfae/ansible-elk/tree/master/install/roles/fluentd/"
    click ES "https://github.com/sadsfae/ansible-elk/tree/master/install/roles/elasticsearch/"
    click CUR "https://github.com/sadsfae/ansible-elk/tree/master/install/roles/curator/"
    click KB "https://github.com/sadsfae/ansible-elk/tree/master/install/roles/kibana/"
    click NX "https://github.com/sadsfae/ansible-elk/tree/master/install/roles/nginx/"
    click AP "https://github.com/sadsfae/ansible-elk/tree/master/install/roles/apache/"
    click XP "https://github.com/sadsfae/ansible-elk/tree/master/install/roles/xpack/"

    %% Styling
    classDef client fill:#90EE90
    classDef security fill:#FFB6C1
    classDef processing fill:#ADD8E6
    classDef storage fill:#DDA0DD
    classDef ui fill:#F0E68C
    classDef proxy fill:#D3D3D3
    classDef maintenance fill:#FFA07A

    %% Legend
    subgraph Legend
        direction TB
        C1["Client Component"]:::client
        S1["Security Component"]:::security
        P1["Processing Component"]:::processing
        ST1["Storage Component"]:::storage
        U1["UI Component"]:::ui
        PR1["Proxy Component"]:::proxy
        M1["Maintenance Component"]:::maintenance
    end
```
