Skip to content

Instantly share code, notes, and snippets.

@anubhavg-icpl
Created September 11, 2024 11:02
Show Gist options
  • Save anubhavg-icpl/13eb615115b087db6da0c890513de45f to your computer and use it in GitHub Desktop.
Save anubhavg-icpl/13eb615115b087db6da0c890513de45f to your computer and use it in GitHub Desktop.

To visualize log files on multiple machines using Netdata and Fluent Bit, you'll need to set up a data pipeline. Here's a high-level overview of how you can achieve this:

  1. Install Fluent Bit on each machine with log files
  2. Configure Fluent Bit to collect and parse your log files
  3. Set up Netdata on a central server or each machine
  4. Configure Fluent Bit to send data to Netdata
  5. Configure Netdata to receive and visualize the data from Fluent Bit

Let's break this down into more detailed steps:

  1. Install Fluent Bit: Follow the official installation guide for your operating system: https://docs.fluentbit.io/manual/installation/getting-started-with-fluent-bit

  2. Configure Fluent Bit: Create a configuration file (usually /etc/fluent-bit/fluent-bit.conf) to collect and parse your log files. Here's a basic example:

    [INPUT]
        Name tail
        Path /path/to/your/logfile.log
        Parser your_log_parser
    
    [PARSER]
        Name your_log_parser
        Format regex
        Regex ^(?<time>[^ ]*) (?<message>.*)$
        Time_Key time
        Time_Format %Y-%m-%d %H:%M:%S
    
    [OUTPUT]
        Name http
        Match *
        Host your_netdata_host
        Port 19999
        URI /api/v1/collector/charts
        Format json_stream
    

    Adjust the Path, Parser, and Regex fields according to your log format.

  3. Install Netdata: Follow the official installation guide: https://learn.netdata.cloud/docs/agent/packaging/installer

  4. Configure Netdata: Enable the web_log plugin in Netdata by editing /etc/netdata/netdata.conf:

    [web_log]
        enabled = yes
    
  5. Start both services:

    sudo systemctl start fluent-bit
    sudo systemctl start netdata
    

Now, Fluent Bit should be collecting your log data and sending it to Netdata, which will visualize it in real-time.

This is a basic setup. Depending on your specific needs, you might want to add more advanced configurations, such as:

  • Filtering and transforming log data in Fluent Bit
  • Setting up aggregation if you have multiple machines
  • Configuring alerting in Netdata
@anubhavg-icpl
Copy link
Author

@meetc-icpl & @sakirm-icpl look into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment