Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
8f927c3
add unknown container
notshivansh Jul 25, 2025
000e003
Merge pull request #112 from akto-api-security/hotfix/fix_no_containers
notshivansh Jul 25, 2025
a6816ff
update version
notshivansh Aug 13, 2025
e9fa4a7
Merge pull request #114 from akto-api-security/hotfix/fix_vuln
notshivansh Aug 13, 2025
a2b0968
add chunk encoding and debug logs
notshivansh Aug 18, 2025
99ae18a
attempt
notshivansh Aug 18, 2025
5c5892b
remove debug logs
notshivansh Aug 20, 2025
d853d48
make limit configurable
notshivansh Aug 20, 2025
99bd902
increase chunk limit
notshivansh Aug 20, 2025
8535a4f
reduce default limit
notshivansh Aug 20, 2025
73f3b8d
Merge pull request #116 from akto-api-security/feature/chunk_encoding
notshivansh Aug 21, 2025
b6629c4
Adding sasl auth in kafka for agent
Ark2307 Sep 1, 2025
176250e
Fixing compilation errors
Ark2307 Sep 2, 2025
2383fe0
adding missing import
Ark2307 Sep 2, 2025
7be7762
Merge pull request #118 from akto-api-security/feature/sasl_auth_kafk…
Ark2307 Sep 2, 2025
c53c2e3
enable threat events push by default
ayushaga14 Sep 30, 2025
b0eb594
remove file logging enabled check on debug urls
ayushaga14 Sep 30, 2025
b4a365b
Merge pull request #124 from akto-api-security/enable-threat-ebpf
ayushaga14 Sep 30, 2025
66d67b3
update script
notshivansh Oct 3, 2025
bdee800
configurable
notshivansh Oct 3, 2025
40c453d
add override
notshivansh Oct 3, 2025
9ab2ed5
take in mb
notshivansh Oct 3, 2025
cdce6c0
Merge pull request #125 from akto-api-security/feature/mem_check
notshivansh Oct 3, 2025
8d4d02a
add go mem limit.
notshivansh Oct 3, 2025
9c7b15c
set go mem limit as 50% of mem threshold
ayushaga14 Oct 5, 2025
e63a15c
set go mem limit as 50% of mem threshold
ayushaga14 Oct 5, 2025
d4eae05
Merge pull request #127 from akto-api-security/feature/mem_check
ayushaga14 Oct 5, 2025
f746861
push source in threat payload
ayushaga14 Nov 19, 2025
c4e2f74
Merge pull request #131 from akto-api-security/fix/push-source-threat
ayushaga14 Nov 19, 2025
6e84665
remove the payload printing
gauravakto Nov 27, 2025
ac26129
Merge pull request #133 from akto-api-security/fix/remove-sample
gauravakto Nov 27, 2025
c4a70ce
exit on kafka error threshold
notshivansh Dec 16, 2025
9895ea7
make optional config changes
notshivansh Dec 16, 2025
5f93245
increase default threshold
notshivansh Dec 16, 2025
9a03ba8
increase threshold
notshivansh Dec 16, 2025
45e40a4
Merge pull request #137 from akto-api-security/feature/kafka_err_restart
notshivansh Dec 16, 2025
d73dfb5
kafka reconnect
notshivansh Dec 24, 2025
e4ada9c
refactor parseAndProduce
gauravakto Dec 25, 2025
20a705c
Merge pull request #140 from akto-api-security/feat/partial-requests
gauravakto Dec 25, 2025
d784ad1
use empty bodies on failures
gauravakto Dec 25, 2025
04e6abe
Merge pull request #141 from akto-api-security/feat/best-effort-disco…
gauravakto Dec 25, 2025
cf4a711
increase and reset timer
gauravakto Dec 25, 2025
c5a88e3
default don't reconnect
notshivansh Dec 26, 2025
bb536cf
add max 10MB limit
gauravakto Dec 26, 2025
b110a01
Merge pull request #142 from akto-api-security/feat/handle-longer-res…
gauravakto Dec 27, 2025
e4feeae
Merge pull request #139 from akto-api-security/feature/kafka_reconnect
notshivansh Dec 29, 2025
1f9ee08
Feature/communicate kafka (#144)
kural-akto Jan 12, 2026
dd96fba
feat: add kafka header
abhijeet-akto Jan 14, 2026
1484955
chore: add check
abhijeet-akto Jan 14, 2026
98933fb
Merge pull request #147 from akto-api-security/abhi/feat/kafka-header
abhijeet-akto Jan 14, 2026
83ce73d
Feature/communicate kafka v2 (#148)
kural-akto Jan 16, 2026
39a588b
Don't resolve pod labels for envoy process Ids. (#134)
gauravakto Jan 19, 2026
fc675cd
Feature/pod profiling (#149)
kural-akto Jan 22, 2026
0f3b91e
added dest ip in the payload
kural-akto Feb 3, 2026
3ab791b
Merge pull request #150 from akto-api-security/fix/add_dest_ip
Ark2307 Feb 4, 2026
eec0615
reduce log level
gauravakto Feb 18, 2026
04a3376
Merge pull request #152 from akto-api-security/fix/mute-logs
notshivansh Feb 18, 2026
9681477
Allow sequence to start from anywehre
gauravakto Feb 20, 2026
1cdd406
Merge pull request #153 from akto-api-security/feat/capture-all-requq…
notshivansh Feb 20, 2026
1dd2c51
Preserve environment variables across process restarts
gauravakto Feb 27, 2026
b9b3b57
change in consumer message type
kural-akto Mar 2, 2026
54bef1c
changes for fix in consumer group id and revert some untested changes
kural-akto Mar 2, 2026
43d4e9b
commit offset manually before processing the message as there is os.e…
kural-akto Mar 2, 2026
0c34412
Merge pull request #158 from akto-api-security/fix/restart-preserver-…
notshivansh Mar 3, 2026
d882fb7
use global transport
ayushaga14 Mar 13, 2026
f0196ca
Merge pull request #173 from akto-api-security/kafka-conn-fix
ayushaga14 Mar 16, 2026
e114475
updated GO image
harshithb3304 Mar 16, 2026
7553d85
updated go version
harshithb3304 Mar 16, 2026
0b50be5
updated Go version
harshithb3304 Mar 17, 2026
b34c0c8
updated script
harshithb3304 Mar 17, 2026
8632c42
updated logs
harshithb3304 Mar 17, 2026
c51de90
shifted to debug
harshithb3304 Mar 17, 2026
1e872d6
updated logs
harshithb3304 Mar 17, 2026
318a864
update code
harshithb3304 Mar 17, 2026
224f19e
updated logs
harshithb3304 Mar 17, 2026
4a56ad5
Merge pull request #176 from akto-api-security/feature/goprocs
notshivansh Mar 17, 2026
701b753
added env read (#175)
harshithb3304 Mar 18, 2026
a51841d
Pre-fill existing connections of kube processes (#169)
gauravakto Mar 23, 2026
b066170
use flag for sequence check
gauravakto Mar 23, 2026
60fbbce
spell fix
gauravakto Mar 23, 2026
5b07f0c
Merge pull request #179 from akto-api-security/fix/put-seq-check-in-flag
notshivansh Mar 23, 2026
c1feb8c
Enhance ebpf-run.sh with new environment variables and improved loggi…
krngrover94 Mar 27, 2026
b613140
Merge pull request #181 from akto-api-security/hide-SIGSEGV-error-logs
notshivansh Mar 27, 2026
999902d
fix cgroup file locations (#186)
gauravakto Apr 23, 2026
30ee0fa
kafka disabled
notshivansh May 8, 2026
2910a1a
Merge pull request #192 from akto-api-security/feature/kafka_disabled
notshivansh May 11, 2026
0311fde
eBPF host binary changes (#200)
gauravakto Jun 12, 2026
9137937
Add OpenSSL 3.5.x SSL uprobe support (#201)
gauravakto Jun 22, 2026
5e9d174
Add amazon2023 arm64 support
gauravakto Jun 24, 2026
779eafe
fix title
gauravakto Jun 24, 2026
6c58690
fix top heading
gauravakto Jun 24, 2026
6486be6
Merge pull request #202 from akto-api-security/feat/al2023-6.1-arm-in…
notshivansh Jun 24, 2026
4af3506
changed log level (#204)
harshithb3304 Jul 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 50 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ on:
options:
- legacy
- ebpf
default: legacy
default: legacy
Architecture:
description: "The target architecture(s) for the Docker image."
required: true
type: choice
options:
- both
- arm64
- amd64
default: both

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down Expand Up @@ -82,11 +91,19 @@ jobs:
ECR_REPOSITORY: akto-api-security
REGISTRY_ALIAS: p7q3h0z2
IMAGE_TAG: ${{ github.event.inputs.Tag }}
ARCH_INPUT: ${{ github.event.inputs.Architecture }}
run: |
# Build a docker container and push it to DockerHub
docker buildx create --use
echo "Building and Pushing image to ECR..."
docker buildx build --platform linux/arm64/v8,linux/amd64 -t $ECR_REGISTRY/$REGISTRY_ALIAS/mirror-api-logging:$IMAGE_TAG . --push
if [ "$ARCH_INPUT" == "arm64" ]; then
PLATFORM="linux/arm64/v8"
elif [ "$ARCH_INPUT" == "amd64" ]; then
PLATFORM="linux/amd64"
else
PLATFORM="linux/arm64/v8,linux/amd64"
fi
echo "Building and Pushing image to ECR with platform: $PLATFORM"
docker buildx build --platform $PLATFORM -t $ECR_REGISTRY/$REGISTRY_ALIAS/mirror-api-logging:$IMAGE_TAG . --push
echo "::set-output name=image::$ECR_REGISTRY/$REGISTRY_ALIAS/mirror-api-logging:$IMAGE_TAG"

- name: Build, tag, and push the image to Amazon ECR -ebpf
Expand All @@ -97,11 +114,19 @@ jobs:
ECR_REPOSITORY: akto-api-security
REGISTRY_ALIAS: p7q3h0z2
IMAGE_TAG: ${{ github.event.inputs.EbpfTag }}
ARCH_INPUT: ${{ github.event.inputs.Architecture }}
run: |
# Build a docker container and push it to DockerHub
docker buildx create --use
echo "Building and Pushing image to ECR..."
docker buildx build --platform linux/arm64/v8,linux/amd64 -t $ECR_REGISTRY/$REGISTRY_ALIAS/mirror-api-logging:$IMAGE_TAG -f Dockerfile.eBPF . --push
if [ "$ARCH_INPUT" == "arm64" ]; then
PLATFORM="linux/arm64/v8"
elif [ "$ARCH_INPUT" == "amd64" ]; then
PLATFORM="linux/amd64"
else
PLATFORM="linux/arm64/v8,linux/amd64"
fi
echo "Building and Pushing image to ECR with platform: $PLATFORM"
docker buildx build --platform $PLATFORM -t $ECR_REGISTRY/$REGISTRY_ALIAS/mirror-api-logging:$IMAGE_TAG -f Dockerfile.eBPF . --push
echo "::set-output name=image::$ECR_REGISTRY/$REGISTRY_ALIAS/mirror-api-logging:$IMAGE_TAG"

build-docker:
Expand Down Expand Up @@ -136,11 +161,19 @@ jobs:
env:
ECR_REGISTRY: aktosecurity
IMAGE_TAG: ${{ github.event.inputs.Tag }}
ARCH_INPUT: ${{ github.event.inputs.Architecture }}
run: |
# Build a docker container and push it to DockerHub
docker buildx create --use
echo "Building and Pushing image to DockerHub..."
docker buildx build --platform linux/arm64/v8,linux/amd64 -t $ECR_REGISTRY/mirror-api-logging:$IMAGE_TAG . --push
if [ "$ARCH_INPUT" == "arm64" ]; then
PLATFORM="linux/arm64/v8"
elif [ "$ARCH_INPUT" == "amd64" ]; then
PLATFORM="linux/amd64"
else
PLATFORM="linux/arm64/v8,linux/amd64"
fi
echo "Building and Pushing image to DockerHub with platform: $PLATFORM"
docker buildx build --platform $PLATFORM -t $ECR_REGISTRY/mirror-api-logging:$IMAGE_TAG . --push
echo "::set-output name=image::$ECR_REGISTRY/mirror-api-logging:$IMAGE_TAG"

- name: Build, tag, and push the image to DockerHub - ebpf
Expand All @@ -149,9 +182,17 @@ jobs:
env:
ECR_REGISTRY: aktosecurity
IMAGE_TAG: ${{ github.event.inputs.EbpfTag }}
ARCH_INPUT: ${{ github.event.inputs.Architecture }}
run: |
# Build a docker container and push it to DockerHub
docker buildx create --use
echo "Building and Pushing image to DockerHub..."
docker buildx build --platform linux/arm64/v8,linux/amd64 -t $ECR_REGISTRY/mirror-api-logging:$IMAGE_TAG -f Dockerfile.eBPF . --push
if [ "$ARCH_INPUT" == "arm64" ]; then
PLATFORM="linux/arm64/v8"
elif [ "$ARCH_INPUT" == "amd64" ]; then
PLATFORM="linux/amd64"
else
PLATFORM="linux/arm64/v8,linux/amd64"
fi
echo "Building and Pushing image to DockerHub with platform: $PLATFORM"
docker buildx build --platform $PLATFORM -t $ECR_REGISTRY/mirror-api-logging:$IMAGE_TAG -f Dockerfile.eBPF . --push
echo "::set-output name=image::$ECR_REGISTRY/mirror-api-logging:$IMAGE_TAG"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ mirroring-api-logging
.idea/
**/.vscode/
temp
**temp
**temp
data-*
4 changes: 2 additions & 2 deletions Dockerfile.eBPF
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM alpine:3.21 AS base
FROM alpine:3.22 AS base

USER root
RUN apk add bcc-tools bcc-dev bcc-doc linux-headers build-base

FROM base AS builder

# Install Go based on architecture
ARG GO_VERSION=1.24.3
ARG GO_VERSION=1.25.8
ARG TARGETARCH

RUN if [ "$TARGETARCH" = "arm64" ]; then \
Expand Down
214 changes: 214 additions & 0 deletions ebpf-bcc-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
#!/bin/sh
#
# MEM_LIMIT (optional): memory cap in integer MiB (mebibytes, 1024-based "MB").
# When set, it overrides cgroup/host detection for MEM_LIMIT_MB and drives
# GOMEMLIMIT, process RSS % kill, and Akto AKTO_MEM_* exports below.
# Example: 52 GiB cap -> MEM_LIMIT=53248 (52 * 1024).
# Omit MEM_LIMIT to auto-detect from cgroup memory.max (Docker/K8s) or host RAM.
#
# AKTO_MEM_HARD_LIMIT — heap alloc hard cap (MiB). Same backing as AKTO_MEM_THRESH_RESTART in Go.
# AKTO_MEM_SOFT_LIMIT — factory buffer soft threshold (MiB). Same backing as TRAFFIC_BUFFER_THRESHOLD.
# AKTO_SYS_MEM_HARD_LIMIT — heap Sys hard cap (MiB).
# If unset, defaults are derived from MEM_LIMIT_MB: soft 80%, hard and sys hard 85%.
# You may set AKTO_MEM_THRESH_RESTART or TRAFFIC_BUFFER_THRESHOLD instead of the client-facing names.

LOG_FILE=${LOG_FILE:-/tmp/dump.log}
MAX_LOG_SIZE=${MAX_LOG_SIZE:-10485760} # Default to 10 MB if not set (10 MB = 10 * 1024 * 1024 bytes)
CHECK_INTERVAL=${CHECK_INTERVAL:-60}
CHECK_INTERVAL_MEM=${CHECK_INTERVAL_MEM:-5} # Check interval in seconds (configurable via env)
MEMORY_THRESHOLD=${MEMORY_THRESHOLD:-85} # Kill ebpf-logging when its RSS reaches this % of MEM_LIMIT (configurable via env)
GOMEMLIMIT_PERCENT=${GOMEMLIMIT_PERCENT:-60} # GOMEMLIMIT as % of container memory limit (configurable via env)
AKTO_SUPPRESS_TRACE=${AKTO_SUPPRESS_TRACE:-true}
CRASH_RESTART_BACKOFF_SECONDS=${CRASH_RESTART_BACKOFF_SECONDS:-10}
EBPF_ROOT="${EBPF_ROOT:-/ebpf}"

# Load bundle env before MEM_LIMIT resolution so MEM_LIMIT / AKTO_* can live in ${EBPF_ROOT}/.env.
if [ -f "${EBPF_ROOT}/.env" ]; then
set -a
# shellcheck disable=SC1090
. "${EBPF_ROOT}/.env"
set +a
fi

# No TTY (e.g. bare-metal nohup): send this script's stdout/stderr to LOG_FILE with ebpf-logging (ENABLE_LOGS=false only).
if [ "${ENABLE_LOGS}" = "false" ] && [ ! -t 1 ]; then
exec >>"$LOG_FILE" 2>&1
fi

# Function to rotate the log file
rotate_log() {
if [ -f "$LOG_FILE" ] && [ -s "$LOG_FILE" ]; then
log_size=$(stat -c%s "$LOG_FILE") # Get the size of the log file
if [ "$log_size" -ge "$MAX_LOG_SIZE" ]; then
echo "" > "$LOG_FILE"
fi
fi
}

# Function to check ebpf-logging RSS and kill if threshold exceeded
check_memory_and_kill() {
CURRENT_MEM=0
for pid in $(pgrep -x ebpf-logging 2>/dev/null); do
rss_kb=$(awk '/^VmRSS:/ {print $2; exit}' "/proc/$pid/status" 2>/dev/null) || continue
[ -n "$rss_kb" ] || continue
CURRENT_MEM=$((CURRENT_MEM + rss_kb * 1024))
done

if [ "$CURRENT_MEM" -eq 0 ]; then
return
fi

PERCENT_USED=$((CURRENT_MEM * 100 / MEM_LIMIT_BYTES))

echo "ebpf-logging memory usage: ${PERCENT_USED}% (${CURRENT_MEM} / ${MEM_LIMIT_BYTES} bytes)"

if [ "$PERCENT_USED" -ge "$MEMORY_THRESHOLD" ]; then
echo "ebpf-logging memory threshold ${MEMORY_THRESHOLD}% exceeded (${PERCENT_USED}%), killing process"
pkill -9 ebpf-logging
fi
}

# Start monitoring in the background
if [ "${ENABLE_LOGS}" = "false" ]; then
while true; do
rotate_log # Check and rotate logs if necessary
sleep "$CHECK_INTERVAL" # Wait for the specified interval before checking again
done &
fi

# 1. Check if MEM_LIMIT is provided as env variable
if [ -z "$MEM_LIMIT" ]; then
# Resolve container's cgroup path (needed when hostPID: true shifts cgroup root)
CGROUP_BASE=$(cut -d: -f3 /proc/self/cgroup | head -1)

# Not provided, detect and read cgroup memory limits
if [ -f "/sys/fs/cgroup${CGROUP_BASE}/memory.max" ]; then
# cgroup v2 with hostPID
MEM_LIMIT_BYTES=$(cat "/sys/fs/cgroup${CGROUP_BASE}/memory.max")
elif [ -f /sys/fs/cgroup/memory.max ]; then
# cgroup v2 normal
MEM_LIMIT_BYTES=$(cat /sys/fs/cgroup/memory.max)
elif [ -f "/sys/fs/cgroup${CGROUP_BASE}/memory.limit_in_bytes" ]; then
# cgroup v1 with hostPID
MEM_LIMIT_BYTES=$(cat "/sys/fs/cgroup${CGROUP_BASE}/memory.limit_in_bytes")
elif [ -f /sys/fs/cgroup/memory/memory.limit_in_bytes ]; then
# cgroup v1 normal
MEM_LIMIT_BYTES=$(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)
else
# Fallback to free -b (bytes) if cgroup file not found
echo "Neither cgroup v2 nor v1 memory file found, defaulting to free -b"
MEM_LIMIT_BYTES=$(free -b | awk '/Mem:/ {print $2}')
fi

# 2. Handle edge cases: "max" (cgroup v2) or 9223372036854775807 (cgroup v1 INT64_MAX) mean no limit
if [ "$MEM_LIMIT_BYTES" = "max" ] || [ "$MEM_LIMIT_BYTES" = "9223372036854775807" ]; then
echo "Cgroup memory limit is unlimited, defaulting to free memory"
MEM_LIMIT_BYTES=$(free -b | awk '/Mem:/ {print $2}')
fi

# 3. Convert the memory limit from bytes to MB (integer division)
MEM_LIMIT_MB=$((MEM_LIMIT_BYTES / 1024 / 1024))
else
# MEM_LIMIT provided as env variable, integer MiB (same unit as MEM_LIMIT_MB from cgroup).
echo "Using MEM_LIMIT from environment variable: ${MEM_LIMIT} MiB"
MEM_LIMIT_MB=$MEM_LIMIT
# Convert MB to bytes for calculations
MEM_LIMIT_BYTES=$((MEM_LIMIT * 1024 * 1024))
fi

echo "Using container memory limit: ${MEM_LIMIT_MB} MB"

AKTO_MEM_SOFT_DEFAULT_MB=$((MEM_LIMIT_MB * 80 / 100))
AKTO_MEM_HARD_DEFAULT_MB=$((MEM_LIMIT_MB * 85 / 100))

# Akto Go-side thresholds (MiB). Client-facing names; Go also accepts legacy aliases (see header).
if [ -z "${AKTO_MEM_HARD_LIMIT:-}" ] && [ -z "${AKTO_MEM_THRESH_RESTART:-}" ]; then
export AKTO_MEM_HARD_LIMIT="${AKTO_MEM_HARD_DEFAULT_MB}"
fi
if [ -z "${AKTO_MEM_SOFT_LIMIT:-}" ] && [ -z "${TRAFFIC_BUFFER_THRESHOLD:-}" ]; then
export AKTO_MEM_SOFT_LIMIT="${AKTO_MEM_SOFT_DEFAULT_MB}"
fi
if [ -z "${AKTO_SYS_MEM_HARD_LIMIT:-}" ]; then
export AKTO_SYS_MEM_HARD_LIMIT="${AKTO_MEM_HARD_DEFAULT_MB}"
fi

# Set GOMEMLIMIT for the Go process
GOMEMLIMIT_MB=$((MEM_LIMIT_MB * GOMEMLIMIT_PERCENT / 100))
export GOMEMLIMIT="${GOMEMLIMIT_MB}MiB"
echo "Setting GOMEMLIMIT to: ${GOMEMLIMIT} (${GOMEMLIMIT_PERCENT}% of ${MEM_LIMIT_MB} MB)"
echo "Akto memory env (MiB): AKTO_MEM_HARD_LIMIT=${AKTO_MEM_HARD_LIMIT:-} AKTO_MEM_SOFT_LIMIT=${AKTO_MEM_SOFT_LIMIT:-} AKTO_SYS_MEM_HARD_LIMIT=${AKTO_SYS_MEM_HARD_LIMIT:-}"

# AKTO_SUPPRESS_TRACE: filters noisy SIGSEGV/cgo trace lines from stderr.
run_ebpf_once() {
log_to_file=false
[ "${ENABLE_LOGS}" = "false" ] && log_to_file=true

if [ "${AKTO_SUPPRESS_TRACE}" != "true" ]; then
if [ "$log_to_file" = "true" ]; then
./ebpf-logging >> "$LOG_FILE" 2>&1
else
./ebpf-logging
fi
return $?
fi

ERRPIPE="/tmp/ebpf-stderr-$$"
rm -f "$ERRPIPE"
if ! mkfifo "$ERRPIPE"; then
return 1
fi

to_logfile=0
[ "$log_to_file" = "true" ] && to_logfile=1

awk -v to_logfile="$to_logfile" -v logf="$LOG_FILE" '
BEGIN { quiet = 0 }
/^SIGSEGV:/ || /^signal arrived during cgo execution/ {
if (!quiet) {
msg = "SIGSEGV/cgo crash (multi-line trace suppressed; set AKTO_SUPPRESS_TRACE=false for full output)"
if (to_logfile) print msg >> logf
else print msg > "/dev/stderr"
}
quiet = 1
next
}
quiet { next }
{
if (to_logfile) print >> logf
else print > "/dev/stderr"
}
' < "$ERRPIPE" &
AWKPID=$!

if [ "$log_to_file" = "true" ]; then
./ebpf-logging >> "$LOG_FILE" 2>"$ERRPIPE"
else
./ebpf-logging 2>"$ERRPIPE"
fi
ebpf_exit=$?
wait "$AWKPID" 2>/dev/null
rm -f "$ERRPIPE"
return "$ebpf_exit"
}

# Start memory monitoring in the background
while true; do
check_memory_and_kill
sleep "$CHECK_INTERVAL_MEM"
done &

while :
do
# Source environment file if it exists (contains vars set by processCommandMessage)
if [ -f "${EBPF_ROOT}/.env" ]; then
set -a
# shellcheck disable=SC1090
. "${EBPF_ROOT}/.env"
set +a
fi

run_ebpf_once
ebpf_exit=$?

sleep "${CRASH_RESTART_BACKOFF_SECONDS}"
done
Loading
Loading