oarevalo / BugLogHQ

BugLogHQ is a tool to centralize the handling of automated bug reports from multiple applications. BugLogHQ provides a unified view of error messages sent from any number of applications, allowing the developer to search, graph, forward, and explore the bug reports submitted by the applications.
http://www.bugloghq.com
155 stars 67 forks source link

Creating a new Rule #132

Closed KrunchMuffin closed 8 years ago

KrunchMuffin commented 8 years ago

I am trying to create a new rule to post to Slack webhook. How can i get the severity and the serverkey?

oarevalo commented 8 years ago

Here is a Slack rule that you can use as a guide: https://github.com/oarevalo/BugLogHQ-utils/tree/master/extensions/rules

KrunchMuffin commented 8 years ago

I have most of that, although I am using attachments. Is there no way to get the serverkey? I want to show the environment.

        var payload = {
            "username": "BugLog",
            "icon_emoji": ":buglog:",
            "attachments": [
                {
                    "fallback": "#q.severityCode# - #q.message#: #getBugEntryHREF(q.EntryID)#",
                    "title": "#intro#",
                    "text": "<#getBugEntryHREF(q.EntryID)#|#q.severityCode# - #q.message#>",
                    "fields": [
                        {
                            "title": "Application",
                            "value": "#q.ApplicationCode#",
                            "short": true
                        },
                        {
                            "title": "Environment",
                            "value": "#ListLast(q.ApplicationCode,'_')#",
                            "short": true
                        },
                        {
                            "title": "Template",
                            "value": "#q.templatePath#",
                            "short": false
                        }
                    ],
                    "color": "danger"
                }
            ]
        };
oarevalo commented 8 years ago

from within your rule try this, I think this will return what you want:

getListener().getConfig().getConfigKey()

alternatively, if you are using instances, you can also use:

getListener().getInstanceName()
KrunchMuffin commented 8 years ago

sweet! works great! Thanks!

oarevalo commented 8 years ago

:+1: