Skip to content

Instantly share code, notes, and snippets.

@endorama
Forked from leehinman/custom_agent_build.md
Created May 2, 2023 16:07
Show Gist options
  • Save endorama/c2245dcf90444861e64f02b186ad6073 to your computer and use it in GitHub Desktop.
Save endorama/c2245dcf90444861e64f02b186ad6073 to your computer and use it in GitHub Desktop.
Custom Agent Build

Assumptions

  • you want a custom version of elastic-agent
  • you want a custom version of one of the beats in elastic-agent
  • beats repo is ~/src/beats
  • elastic-agent repo is ~/src/elastic-agent

Create necessary temp dirs

mkdir -p ~/tmp/artifacts
mkdir -p ~/tmp/agent_drop_path

Build Custom Beat

  1. cd to beats directory

    cd ~/src/beats
  2. checkout tag that matches the version you want

    git checkout v8.7.0
  3. Make changes you want

  4. Build your beat

    cd x-pack/metricbeat
    DEV=true SNAPSHOT=false PLATFORMS="linux/arm64" mage -v clean package
    cp build/distributions/metricbeat-8.7.0-linux-arm64.tar.gz* ~/tmp/artifacts

Download any other beats you need (filebeat & metricbeat are minimums)

cd ~/tmp/artifacts
curl -O -J -L https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.7.0-linux-arm64.tar.gz
curl -O -J -L https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.7.0-linux-arm64.tar.gz.sha512

Build agent

  1. change to agent directory

    cd ~/src/elastic-agent
  2. check out version to match the beat

    git checkout v8.7.0
  3. add your beats to agentdroppath

    cp ~/tmp/artifacts/* ~/tmp/agent_drop_path
  4. build elastic-agent

    DEV=true AGENT_DROP_PATH=/Users/hinman/tmp/agent_drop_path PLATFORMS="linux/arm64" PACKAGES="tar.gz" mage -v clean package
  5. custom elastic-agent distribuion is in build/distribuitons

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