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

**URL:** https://discuss.elastic.co/t/error-setting-packetbeat-protocols-http-ports-with-environment-variable/61559
**Category:** Beats
**Tags:** packetbeat
**Created:** [September 27, 2016, 5:30am UTC](https://discuss.elastic.co/t/error-setting-packetbeat-protocols-http-ports-with-environment-variable/61559 "2016-09-27T05:30:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![gunzy83](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gunzy83/32/12168_2.png) [@gunzy83](https://discuss.elastic.co/u/gunzy83)
#### Post date: [September 27, 2016, 5:30am UTC](https://discuss.elastic.co/t/error-setting-packetbeat-protocols-http-ports-with-environment-variable/61559/1 "2016-09-27T05:30:25Z")

</div>

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:

```auto
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:

```auto
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:

```bash
#!/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.

---

<div class="post-metadata">

### Author: ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)
#### Post date: [September 29, 2016, 9:46am UTC](https://discuss.elastic.co/t/error-setting-packetbeat-protocols-http-ports-with-environment-variable/61559/2 "2016-09-29T09:46:58Z")

</div>

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

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [October 18, 2016, 5:30am UTC](https://discuss.elastic.co/t/error-setting-packetbeat-protocols-http-ports-with-environment-variable/61559/3 "2016-10-18T05:30:24Z")

</div>

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