Error setting 'packetbeat.protocols.http.ports' with environment variable


(Ross Williams) #1

I have run into an issue with 5.0.0-beta1 that I would like to report or ensure it is not PEBCAK. I am configuring packetbeat to monitor a single service in a docker container that exposes itself on host port MONITORED_PORT as per the configuration below:

packetbeat:
  interfaces:
    device: any
  protocols:
    http:
      ports:
        - ${MONITORED_PORT}
output:
  redis:
    hosts:
      - '${BROKER_HOSTNAME}:${BROKER_PORT}'
fields:
  service_name: ${SERVICE_NAME}

The following error is returned:

2016/09/27 04:19:14.682990 protos.go:117: ERR Failed to register protocol plugin: can not convert 'string' into 'int' accessing 'packetbeat.protocols.http.ports' (source:'command line flag')
2016/09/27 04:19:14.683016 beat.go:285: CRIT Exiting: Initializing protocol analyzers failed: can not convert 'string' into 'int' accessing 'packetbeat.protocols.http.ports' (source:'command line flag')
Exiting: Initializing protocol analyzers failed: can not convert 'string' into 'int' accessing 'packetbeat.protocols.http.ports' (source:'command line flag')

The variable is definitely set (when I hardcode the port value and test ${MONITORED_PORT} as a second field it works. I have also tried a number of ways to specify the port number (eg inside []) with no success. I have a workaround for now which is specifying the variable at the command-line when starting packetbeat:

#!/bin/bash
./packetbeat/packetbeat -v -e -c=/opt/packetbeat/packetbeat.yml -E packetbeat.protocols.http.ports=$MONITORED_PORT

I am prepared to write up an issue on Github if this is confirmed but any help or advice would be appreciated.


(Steffen Siering) #2

This looks like a regression in https://github.com/elastic/go-ucfg ?

The error message says the ports have been set on command line. Is this correct?


(system) #3

This topic was automatically closed after 21 days. New replies are no longer allowed.