Table of Contents
As a provider of a own software solution, it’s important to ensure that your system is always online and available to your users. One way to do this is by periodically sending a “keep alive” signal to a server to monitor its online status. With LogHive Insights, you can easily set up this check and view the state of your system on a dashboard.
Set up the keep alive signal in PHP
First, you’ll need to set up a keep alive signal that sends a request to your server at regular intervals. This signal can be as simple as a small HTTP request that pings the server and checks if it’s up and running.
Here’s an example of how you could implement this in PHP:
Simply send an Insight with the value 0 or 1 to LogHive.
Code example for PHP
<?php
// curl
$url = 'https://api.loghive.app/v1/insight/add';
$data = array(
'project' => 'MySaas',
'insight' => 'system1-online',
'value' => 1
);
$json_data = json_encode($data);
// Init
$ch = curl_init();
// cURL-Optionen
curl_setopt($ch, CURLOPT_URL, $url); // Setzen der URL
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Setzen von CURLOPT_RETURNTRANSFER auf true, um die Antwort in eine Variable zu speichern
curl_setopt($ch, CURLOPT_POST, true); // Setzen von CURLOPT_POST auf true, um eine POST-Anfrage zu senden
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data); // Setzen des JSON-Body
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json', // Setzen des Content-Type-Headers auf application/json
'ApiKey: YourPersonalApiKey' // Setzen des Authorization-Headers
));
// Exec
$response = curl_exec($ch);
if(curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
}
curl_close($ch);
if($response) {
echo($response);
}
?>
You will receive the project and group name, as well as the ApiKey, in the following step when you create an account.
Check out code examples in other programming languages.: https://docs.loghive.app/code-examples/python
Set up a LogHive Account
Sign up for LogHive and create a free account. Navigate to the webapp at https://app.loghive.app/.
You can find your API key in your user profile.
Set up the the dashboard
Once you have the keep alive signal set up, you’ll need to create a dashboard in LogHive Insights to view the state of your system. To do this, log in to the LogHive web application.
Next, you’ll need to add a widget to the dashboard that displays the online state of your system.

Now that you have the keep alive signal and dashboard set up, you can monitor the state of your system . If the server fails to respond to the keep alive signal, you’ll be notified in the LogHive dashboard, allowing you to quickly address any issues that may arise.

In conclusion, monitoring the online state of your system is an important task that can be easily accomplished using LogHive Insights. By setting up a keep alive signal and monitoring it on the LogHive dashboard, you can ensure that your system is always online and available to your users.