Skip to content

hostname always comes in empty in slack messages #29

@andreygubarevich

Description

@andreygubarevich

Hello!

I was able to successfully set up this module and use it however I faced an issue with 'hostname' always coming as empty.
Same if I use property("HOSTNAME") instead. However the if condition which uses it works just fine.
Can you take a look.

My logback config looks like this:

<if condition='!property("HOSTNAME").contains("local")'>
        <then>
            <appender name="SLACK" class="jp.co.dwango.logback.SlackWebhookAppender">
                <webhookUrl>xyz</webhookUrl>
                <timeout>50000</timeout>
                <payload>
                    {
                    "channel": "#channel-layer-notifications",
                    "username": "username",
                    "icon_emoji": emoji,
                    "link_names": 1,
                    "attachments": [{
                    "title": level,
                    "color": color,
                    "fields": [
                    {
                    "title": "Hostname",
                    "value": hostname,
                    "short": true
                    },
                    {
                   "title": "Message: ",
                    "value": message,
                    "short": false
                    }
                    ]}
                    ]}
                </payload>
            </appender>
            <appender name="ASYNC_SLACK" class="ch.qos.logback.classic.AsyncAppender">
                <appender-ref ref="SLACK" />
                <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
                    <level>ERROR</level>
                </filter>
            </appender>
            <root level="ERROR">
                <appender-ref ref="ASYNC_SLACK" />
            </root>
      </then>
      <else>
          ... other config
      </else>
</if>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions