edgecomllc / eupf

5G User Plane Function (UPF) based on eBPF
Apache License 2.0
95 stars 14 forks source link

unable to getting debug log from eBPF programs inside "/sys/kernel/debug/" #509

Closed kouamdo closed 6 months ago

kouamdo commented 6 months ago

Hi , here is my docker-compose file and i want to have logs by using cat /sys/kernel/debug/tracing/trace_pipe after tried ping google.com -I 10.33.0.2 inside UE

version: '2.4'

services:
  eupf:
    image: ghcr.io/edgecomllc/eupf:main
    entrypoint: /bin/sh -c "ip route del default;ip route add default via 172.16.0.13 dev eth2 && sh /app/bin/entrypoint.sh --config /app/bin/eupf_config.yml"
    privileged: true
    volumes:
      - /sys/fs/bpf:/sys/fs/bpf
      - /sys/kernel/debug:/sys/kernel/debug:ro
      - ./eupf_config.yml:/app/bin/eupf_config.yml
    ulimits:
      memlock: -1
    cap_add:
      - NET_ADMIN
      - SYS_ADMIN
    ports:
      - 2152:2152/udp
      - 8805:8805/udp
      - 8081:8081
      - 9091:9091
    restart: unless-stopped
    networks:
      n3:
        ipv4_address: 172.18.0.12
      n4:
        ipv4_address: 172.19.0.12
      n6:
        ipv4_address: 172.16.0.12
    sysctls:
      - net.ipv4.conf.all.forwarding=1

  net-tools:
    image: praqma/network-multitool:alpine-extra@sha256:47b259d4463950f5c10d9c0bf63d9e71ec456618f5549a414afa0c04392e0ac1
    privileged: true
    restart: unless-stopped
    networks:
      n6:
        ipv4_address: 172.16.0.13
    command:
      - /bin/sh
      - -c
      - |
        ip ro add 10.33.0.0/16 via 172.16.0.12 dev eth0
        echo "done"
        tail -f /dev/null

networks:
  n3:
    external: true
  n4:
    external: true
  n6:
    external: true

also , we have this inside /app/bin/eupf_config.yml :

interface_name: [eth0,eth2]
xdp_attach_mode: generic
api_address: :8081
pfcp_address: :8805
pfcp_node_id: 172.19.0.12
metrics_address: :9091
n3_address:  172.18.0.12
feature_ftup: true
teid_pool: 65536
logging_level: debug

i have trying debug level , but i don't have traffic information. Please firstly let me know where i have mistaken , also i want to know all different value that we can configure inside logging_level

s5uishida commented 6 months ago

@kouamdo

Probably you must build the docker image with --build-arg BPF_ENABLE_LOG=1 as described below.

https://github.com/edgecomllc/eupf/tree/main#build-docker-image

kouamdo commented 6 months ago

it does not work. sorry. By using that docker compose file :

version: '2.4'

services:
  eupf:
    image: ghcr.io/edgecomllc/eupf:main
    entrypoint: /bin/sh -c "ip route del default;ip route add default via 172.16.0.13 dev eth2 && sh /app/bin/entrypoint.sh --config /app/bin/eupf_config.yml"
    privileged: true
    environment:
      - GIN_MODE=release
      - BPF_ENABLE_LOG=1

    volumes:
      - /sys/fs/bpf:/sys/fs/bpf
      - /sys/kernel/debug:/sys/kernel/debug:ro
      - ./eupf_config.yml:/app/bin/eupf_config.yml
    ulimits:
      memlock: -1
    cap_add:
      - NET_ADMIN
      - SYS_ADMIN
    ports:
      - 2152:2152/udp
      - 8805:8805/udp
      - 8081:8081
      - 9091:9091
    restart: unless-stopped
    networks:
      n3:
        ipv4_address: 172.18.0.12
      n4:
        ipv4_address: 172.19.0.12
      n6:
        ipv4_address: 172.16.0.12
    sysctls:
      - net.ipv4.conf.all.forwarding=1

  net-tools:
    image: praqma/network-multitool:alpine-extra@sha256:47b259d4463950f5c10d9c0bf63d9e71ec456618f5549a414afa0c04392e0ac1
    privileged: true
    restart: unless-stopped
    networks:
      n6:
        ipv4_address: 172.16.0.13
    command:
      - /bin/sh
      - -c
      - |
        ip ro add 10.33.0.0/16 via 172.16.0.12 dev eth0
        echo "done"
        tail -f /dev/null

networks:
  n3:
    external: true
  n4:
    external: true
  n6:
    external: true
s5uishida commented 6 months ago

@kouamdo

Isn't ghcr.io/edgecomllc/eupf:main image built with --build-arg BPF_ENABLE_LOG=0?

In that case, I don't think you can get kernel logs even if you use this image.

kouamdo commented 6 months ago

So it is not possible to getting kernel logs using docker images?

linouxis9 commented 6 months ago

Hi @kouamdo, As mentioned by @s5uishida, you need to rebuild locally the docker image with docker build -t local/eupf:latest --build-arg BPF_ENABLE_LOG=1 (while in the eUPF directory cloned from GitHub), and then replace in your docker-compose ghcr.io/edgecomllc/eupf:main with local/eupf:latest.