[FEATURE] Configurable message format alert
Opened this issue · 0 comments
dwisiswant0 commented
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
Example:
slack:
webhook: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
token: "xoxo-...."
color: "#ffd21a"
channel: "G30SPKI"
# Browse available fields at https://pkg.go.dev/github.com/slack-go/slack#Attachment
format:
- Title: "Request"
Text: "{{ .request_method }} {{ .request_uri }} {{ .request_protocol }}"
- Fields:
- Title: "Date"
Value: "{{ .time_local }}"
Short: true
- Title: "IP Address"
Value: "{{ .remote_addr }}"
Short: true
- Title: "User-Agent"
Value: "{{ .http_user_agent }}"
Short: true
- Title: "Referer"
Value: "{{ .http_referer }}"
Short: true
- Title: "Status code"
Value: "{{ .status }}"
Short: true
- Title: "Bytes sent"
Value: "{{ .body_bytes_sent }}"
Short: true
mattermost:
webhook: "http://HOST/hooks/XXXXX-KEY-XXXXX"
color: "#ffd21a"
# The message format for Slack is compatible with Mattermost, so it's basically the same.
format:
- Title: "Request"
Text: "{{ .request_method }} {{ .request_uri }} {{ .request_protocol }}"
- Fields:
- Title: "Date"
Value: "{{ .time_local }}"
Short: true
- Title: "IP Address"
Value: "{{ .remote_addr }}"
Short: true
- Title: "User-Agent"
Value: "{{ .http_user_agent }}"
Short: true
- Title: "Referer"
Value: "{{ .http_referer }}"
Short: true
- Title: "Status code"
Value: "{{ .status }}"
Short: true
- Title: "Bytes sent"
Value: "{{ .body_bytes_sent }}"
Short: true
telegram:
token: "123456:ABC-DEF1234...-..."
chat_id: "-111000"
format: |
Request: `{{ .request_method }} {{ .request_uri }} {{ .request_protocol }}`
Date: `{{ .time_local }}`
IP Address: `{{ .remote_addr }}`
User\-Agent: `{{ .http_user_agent }}`
Referrer: `{{ .http_referer }}`
Status code: `{{ .status }}`
Bytes sent: `{{ .body_bytes_sent }}`
discord:
webhook: "https://discord.com/api/webhooks/0000000000/XXXXX"
token: "NkWkawkawkawkawka.X0xo.n-kmZwA8aWAA"
color: "16312092"
channel: "700000000000000..."
format:
Fields:
- Name: "Request"
Value: "{{ .request_method }} {{ .request_uri }} {{ .request_protocol }}"
- Name: "Date"
Value: "{{ .time_local }}"
Inline: true
- Name: "IP Address"
Value: "{{ .remote_addr }}"
Inline: true
- Name: "User-Agent"
Value: "{{ .http_user_agent }}"
Inline: true
- Name: "Referer"
Value: "{{ .http_referer }}"
Inline: true
- Name: "Status code"
Value: "{{ .status }}"
Inline: true
- Name: "Bytes sent"
Value: "{{ .body_bytes_sent }}"
Inline: true
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.