Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

SPLUNK_HOSTNAME variable doesn't set the hostname

未关闭
#732 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
docker

调研方向

Reproduce the issue with the supplied compose YAML and .env file using the Splunk Universal Forwarder 9.4.12 image. Start by tracing how SPLUNK_HOSTNAME is handled during container startup and compare it with SPLUNK_BEFORE_START_CMD=set default-hostname REDACTED. Done means the environment variable sets the hostname, or the documented workaround is made explicit.

由索引模型根据 Issue 内容生成。

描述

I tried looking in /etc/hostname, a btool of server and inputs configs, and I can't find the value I set for SPLUNK_HOSTNAME. This is using the version 9.4.12 of the UF image on dockerhub, here's my redacted config file:

splunk:
  role: splunk_universal_forwarder
  service_name: SplunkForwarder
  conf:
    - key: inputs
      value:
        directory: /opt/splunkforwarder/etc/system/local
        content:
          default:
            _meta: "org_id::CHANGEME"
    - key: server
      value:
        directory: /opt/splunkforwarder/etc/system/local
        content:
          deployment:
            pass4SymmKey: REDACTED

And my ENV file:

DEPLOYMENT_SYMM_REPLACE=REDACTED
SPLUNK_BEFORE_START_CMD=add forward-server REDACTED:9997 -client-cert /mnt/certs/cert.pem -ssl-root-ca-path /mnt/certs/cacert.pem -ssl-verify-server-cert true
SPLUNK_PASSWORD=REDACTED
SPLUNK_HOSTNAME=REDACTED
DEBUG=true

And my compose yaml:

version: '3.8'

services:
  busybox-app:
    image: busybox:latest
    container_name: busybox-app
    command: >
      sh -c '
        mkdir -p /var/log/busybox &&
        counter=1 &&
        while true; do
          echo "$$(date +"%Y-%m-%d %H:%M:%S") [ID:$$counter] Test message unique string buffalo" >> /var/log/busybox/busy.log;
          counter=$$((counter + 1));
          sleep 5;
        done
      '
    volumes:
      - shared-logs:/var/log/busybox
    restart: unless-stopped

  splunk-forwarder:
    image: splunk/universalforwarder:9.4.12
    container_name: splunk-forwarder
    env_file: ./.env
    environment:
      SPLUNK_ADD: "monitor /var/log/busybox/busy.log -sourcetype generic_single_line -index main"
      SPLUNK_START_ARGS: --accept-license
    volumes:
      - shared-logs:/var/log/busybox
      # Only needed if overwriting config
      - ./configs.yml:/tmp/defaults/default.yml
      - ./certs/:/mnt/certs/
    depends_on:
      - busybox-app
    restart: unless-stopped

volumes:
  shared-logs:

For people looking at this in the future, the workaround is to use the splunk set default-hostname command in your env file:

SPLUNK_BEFORE_START_CMD=set default-hostname REDACTED
主要语言
Python
星标
551
派生
279
平均合并
3 天 9 小时
30 天内合并 PR
2

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

splunk/docker-splunk 的其他 Issue

查看 splunk/docker-splunk 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。