# Logging tags (rancher-specific)

**URL:** <https://forums.suse.com/t/logging-tags-rancher-specific/7473>\
**Category:** General\
**Created:** [October 2, 2017, 10:00am UTC](https://forums.suse.com/t/logging-tags-rancher-specific/7473 "2017-10-02T10:00:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkaramol](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/pkaramol/32/2883_2.png) [@pkaramol](https://forums.suse.com/u/pkaramol)\
**Post date:** [October 2, 2017, 10:00am UTC](https://forums.suse.com/t/logging-tags-rancher-specific/7473/1 "2017-10-02T10:00:05Z")

</div>

I am trying to log some events in a remote syslog logging server (elk stack with syslog plugin).

I have managed to create `docker` specific tags as follows:

```
logging:
  driver: syslog
  options:
    syslog-address: "tcp://someserver:someport"
    tag: '{{.Name}},{{.ImageName}}'

```

Is this an analogy for rancher tags?

The following syntax does not seem to work:

```
logging:
  driver: syslog
  options:
    syslog-address: "tcp://someserver:someport"
    tag: '{{ index .ContainerLabels "io.rancher.stack.name" }}'

```

The error I am getting for example in this approach is:

> found unexpected end of stream

The following seems to cause no template specific errors but logs `<no value>`

`tag: '{{ .io.rancher.stack.name }}'`

Any suggestion if such a thing is feasible and what is the correct syntax?

**UPDATE1** : The following variable seems to provide the stack name: `{{ Stack.Name }}`.

What other variables are available? `{{ Service.Name }}` does not seem to work for example.

**UPDATE2** : Docker variables do not seem to be available in a rancher environment, i.e. the following

> ```
> tag: '{{.Stack.Name}},{{.Name}},{{.ImageName}}'
> 
> ```

will expand to:

> mystack,\<no value\>,\<no value\>

**UPDATE2** : any idea why the following produces

> yaml error: unexpected end of stream

```
logging:
  driver: syslog
  options:
    syslog-address: "tcp://my-logging-server:my-logging-port
    tag: '{{ index .ContainerLabels "io.rancher.stack.name" }}'

```

---

<div class="post-metadata">

**Author:** ![pkaramol](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/pkaramol/32/2883_2.png) [@pkaramol](https://forums.suse.com/u/pkaramol)\
**Post date:** [October 3, 2017, 10:09am UTC](https://forums.suse.com/t/logging-tags-rancher-specific/7473/2 "2017-10-03T10:09:30Z")

</div>

Using the exact same file, and `ssh`-ing into rancher server and executing

`rancher-compose -f thefile.yml up`

works!

Could this imply some encoding related issues that mix up the file when uploading it via the `rancher`-ui?

**edit** : [filed as a bug](https://github.com/rancher/rancher/issues/9999)
