Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hostname always comes in empty in slack messages #29

Open
andreygubarevich opened this issue Apr 7, 2021 · 0 comments
Open

hostname always comes in empty in slack messages #29

andreygubarevich opened this issue Apr 7, 2021 · 0 comments

Comments

@andreygubarevich
Copy link

andreygubarevich commented Apr 7, 2021

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant