Parameter of HTTP callback Alert

(DukDui) #1

Hi everyone

I want to know parameter of HTTP callback Alert for configure php file to Line alert.

This is my php code.

<?php $message=$_POST['check_result']; $sendmsg ="\nMessage=".$message; $accessToken = $_GET['token']; $ch=curl_init(); curl_setopt($ch,CURLOPT_URL,""); curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS, "message=".urlencode($sendmsg)); curl_setopt($ch,CURLOPT_FOLLOWLOCATION, 1); $headers = array( 'Content-type: application/x-www-form-urlencoded', 'Authorization: Bearer '.$accessToken, ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $status = curl_exec($ch); $error = curl_error($ch); curl_close($ch); if($error) { echo 'error: '.curl_error($ch); } else { $result_ = json_decode($status, true); echo "status : ".$result_['status']; echo "message : ". $result_['message']; } ?>

(Jochen) #2

(DukDui) #3

Hi Jochen

I see already but I don’t understand.

(Jochen) #4

It’s an example of the JSON payload sent via HTTP POST by the Graylog HTTP alarm callback.

You can get the information you need out of that JSON structure.

(DukDui) #5

Hi Jochen


I will try

(DukDui) #6

Hi Jochen

I have a bit question.

How to get value “matching_messages” such as $dataJson[‘check_result’][‘matching_messages’][‘source’] ?

Please tell me.

(Jochen) #7

matching_messages is an array and you have to iterate over it to access individual messages.

(DukDui) #8

Please tell me for example.

(Jochen) #9

Please refer to

(DukDui) #10

Hi Jochen

Thank you for your information.

if i would like to get title name of alert, Do you have how to?


(Jochen) #11

That’s part of the JSON structure you receive from the Graylog HTTP Alarm Callback (“check_result” → “triggered_condition” → “description”).

(DukDui) #12

Ok Thank very much.


(system) #13

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