Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

[FEATURE] Configurable message format alert #239

Description

@dwisiswant0

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.

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions