LogStreamr Documentation

website·Indexed 30 days ago

https://docs.jakebusse.net

Technical documentation for LogStreamr, including system requirements, installation guides, and a product overview.

Tokens
3.7K
Snippets
28
Records
36
Agent score
49%

What's inside LogStreamr

  1. LogStreamr Overview

    LogStreamr is a lightweight, open-source log forwarding agent written in Go. It is designed for Linux-first environments (edge/VM deployments) to tail log files and send them to central aggregation services (such as Loki or Elasticsearch) via HTTP. It runs as a systemd service and uses a YAML configuration file.
  2. Create a non-root sudo user for production

    For security in production environments, avoid running services as the root user. Create a new user and add them to the sudo group to perform administrative tasks.
    # Create the user
    sudo adduser [username]
    
    # Add user to the sudo group
    sudo usermod -aG sudo [username]
    
    # Switch to the new user
    su - [username]
  3. Build LogStreamr from source

    To build LogStreamr from source, you need Go 1.20+ installed. Clone the repository and use either go build or the provided Makefile.

    • go build creates the binary in the current directory.
    • make build creates the binary in the ./bin/ directory.

    After building, you must manually perform the installation steps: copy the binary to /usr/local/bin, create /etc/logstreamr/, add a configuration file, and set up the systemd service.

    git clone https://github.com/streamstack/logstreamr.git
    cd logstreamr
    
    # Option 1: Standard Go build
    go build
    
    # Option 2: Using Makefile
    make build
  4. Create a non-root sudo user for production

    For security in production environments, avoid running services and management tasks as the root user. Create a dedicated user and grant them sudo privileges.
    # Create the new user
    sudo adduser [username]
    
    # Add user to the sudo group
    sudo usermod -aG sudo [username]
    
    # Switch to the new user
    su - [username]
  5. Prerequisites for installing a LAMP stack on Linux

    To install and configure a LAMP stack, ensure the following requirements are met:

    • Operating System: A Linux-based system. While the guide focuses on Ubuntu and Debian-based systems, it can be adapted for CentOS or AlmaLinux.
    • Privileges: Root or sudo access is required to install packages and modify system configuration files.
    • Connectivity: An active internet connection to download packages and updates from official repositories.
    • Skills: Basic familiarity with the command line, including navigating directories, using the apt package manager, editing configuration files, and managing system services.
  6. Verify LogStreamr installation using the version command

    After installing LogStreamr, run logstreamr --version to verify the installation. For prebuilt binaries (installed via install.sh or tarball), the output includes the version, commit hash, Go version, and build date. For manual builds from source using go build, the output may only show the version number.
    logstreamr --version
    # Expected output for prebuilt binary:
    logstreamr v0.1.0 (build 3e29f0a) linux/amd64
    Built with Go 1.20.6 on 2024-04-15
    
    # Expected output for manual source build:
    logstreamr v0.1.0
  7. Install and verify PHP integration with nginx

    Install PHP and verify its communication with the nginx web server. Verification involves checking the installed version and creating a test PHP file in the web root directory to ensure the server can execute PHP code and return a response.
    # Install PHP
    sudo apt install php -y
    
    # Check PHP version
    php -v
    
    # Create a test PHP file
    sudo touch /var/www/html/test.php

    Add the following content to /var/www/html/test.php:

    <?php
    echo "Today's date is ".date('Y-m-d H:i:s');