Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

host argument value in docker compose setting #196

Open
SebastianScherer88 opened this issue Dec 20, 2023 · 0 comments
Open

host argument value in docker compose setting #196

SebastianScherer88 opened this issue Dec 20, 2023 · 0 comments

Comments

@SebastianScherer88
Copy link

hey there,

Problem

i'm trying to test this out in a docker compose setting, but struggling to get the fluentd service to receive the logs being sent by the application using the fluentd logger in another service. reduced docker compose yaml:

Approach

services:

  test-server:
    profiles: [fluentd]
    build:
      context: ./test_server
      dockerfile: Dockerfile
    image: fluentd-logging-server
    command: [python, /home/fluent-logging/test_server/test_server async_fluentd.py]
    environment:
      LOG_FILE: /home/fluent-logging/logs/dummy-input-server.log
      TAG: log.server # populates `tag` positional argument of the fluentd async handler
      HOST: localhost # populates `host` keyword argument of the fluentd async handler
      PORT: 24224 # populates `port` keyword argument of the fluentd async handler
    volumes:
      - type: bind
        source: ./
        target: /home/fluent-logging

  fluentd:
    profiles: [fluentd]
    build:
      context: ./fluentd
      dockerfile: Dockerfile
    image: fluentd-logging-daemon
    command: fluentd -c /etc/fluent/fluent.conf -v
    ports:
      - "24224:24224"
      - "24224:24224/udp"
    volumes:
      - type: bind
        source: ./fluentd/fluentd.conf
        target: /etc/fluent/fluent.conf

reduced fluentd config:

<source>
  @type forward
  port          24224
  <parse>
    @type json
  </parse>
</source>

<filter log.server>
  @type record_transformer
  <record>
    log_framework fluentd
    service_name  fluentd-test
    test          true
  </record>
</filter>

<match log.server>
  @type stdout
</match>

Context

The aim is to eventually deploy this on K8s, but that seems questionable at this point: see here and here. Fluentd's official doc also only mention this library in a non-containerized localhost scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant