${message.message} not working in the alert template


(Mohamed Bahaa) #1

Dears,

please support me as i can’t find out for the below scripts used in the Notifications template

message id: {message.id} message : {message.message}
message source}: {message.source} timestamp: {message.timestamp}
message fields: ${message.fields}


(Jan Doberstein) #2

please share the complete notification setting you like to use.

In addition the documentation might help: http://docs.graylog.org/en/2.4/pages/streams/alerts.html#notifications


(Mohamed Bahaa) #3

Thx Jan for your response; HYG

==========================

  • body:

########## Alert Description: {check_result.resultDescription} Date: {check_result.triggeredAt} Stream ID: {stream.id} Stream title: {stream.title} Stream description: {stream.description} Alert Condition Title: {alertCondition.title} {if stream_url}Stream URL: {stream_url}{end} Triggered condition: {check_result.triggeredCondition} ########## message id: {message.id} message : {message.message} message source}: {message.source} timestamp: {message.timestamp} message fields: {message.fields} ########## {if backlog}Last messages accounting for this alert: {foreach backlog message}{message} {end}{else}<No backlog> ${end}

  • email_receivers:

*******.@

  • sender:

*******.@

  • subject:

Graylog alert for stream: {stream.title}: {check_result.resultDescription}

  • user_receivers:

<empty>

==========================


(Jan Doberstein) #4

what you provide does not look like the template from the notification configuration. The default looks like this:

##########
Alert Description: ${check_result.resultDescription}
Date: ${check_result.triggeredAt}
Stream ID: ${stream.id}
Stream title: ${stream.title}
Stream description: ${stream.description}
Alert Condition Title: ${alertCondition.title}
${if stream_url}Stream URL: ${stream_url}${end}

Triggered condition: ${check_result.triggeredCondition}
##########

${if backlog}Last messages accounting for this alert:
${foreach backlog message}${message}

${end}${else}<No backlog>
${end}


(Mohamed Bahaa) #5

Yes I’d edited the template to have the log message field in the notification


(Jan Doberstein) #6

how does your message template look like exactly?


(Mohamed Bahaa) #7

HYG

this means that i only add the below part in addition to the default teamplate

##########

message id: {message.id} message : {message.message}
message source}: {message.source} timestamp: {message.timestamp}
message fields: ${message.fields}

##########

========================================================================
body:

########## Alert Description: {check_result.resultDescription} Date: {check_result.triggeredAt} Stream ID: {stream.id} Stream title: {stream.title} Stream description: {stream.description} Alert Condition Title: {alertCondition.title} {if stream_url}Stream URL: {stream_url}{end} Triggered condition: {check_result.triggeredCondition} ########## message id: {message.id} message : {message.message} message source}: {message.source} timestamp: {message.timestamp} message fields: {message.fields} ########## {if backlog}Last messages accounting for this alert: {foreach backlog message}{message} {end}{else}<No backlog> ${end}

  • email_receivers:

mohamed.bahaa@etisalatdata.net

  • sender:

mohamed.bahaa@etisalatdata.net

  • subject:

Graylog alert for stream: {stream.title}: {check_result.resultDescription}

  • user_receivers:

<empty>

=======================================================================


#8

Do you set a backlog in the alert configuration ? because if backlog is set to 0 the notification can’t get any message.


(Mohamed Bahaa) #9

i’d removed the backlog setting from the alert configuration (as in below snapshot); but still message field is empty

*image


#10

The screenshot shows alert notification settings. Could you provide a screenshot of alert condition settings ?


(Mohamed Bahaa) #11

sorry for delay

HYG


(Jan Doberstein) #12

the message information from the backlog are only available in the foreach loop

${if backlog}Last messages accounting for this alert:
${foreach backlog message}${message}

${end}${else}<No backlog>
${end}


(Mohamed Bahaa) #13

thanks for your support, but could you please elaborate more; shall i add the part you mentioned in configuration; & where exactly please?


(Mohamed Bahaa) #14

Thx Jan

i added the part into my Condition & found the message content :grinning:

could you please provide me with a document including all syntax options like : ({foreach backlog message}{message})

to be able to use all available features


(Jan Doberstein) #15

just look at the official documentation: http://docs.graylog.org/en/2.4/pages/streams/alerts.html


(Mohamed Bahaa) #16

Hi Jan,

i tried to check the documentation but couldn’t reach the proper way to get separated display method for example: for (message.fields, message.source …etc.)

can you help please?

image


(Jan Doberstein) #17

could you please share your alert body in a way I can copy&paste work with that. Using the image is not a way I can easily modify your given information.


(system) #18

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.