I'm looking to send both system.log and exception.log from my magento to the website logz.io for analyse purpose. My server from Nexcess doesn't autorize installing filebeat so i thought using the cURL method and periodically send it with cron. Here is the code so far :
<?php //Initialise the cURL var $ch = curl_init(); //Get the response from cURL curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set the Url curl_setopt($ch, CURLOPT_URL, 'http://listener.logz.io:8021/file_upload/mypersonalcode/'); //Create a POST array with the file in it $postData = array( 'testData' => '@/var/log/system.log', ); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); // Execute the request $response = curl_exec($ch); ?>
But nothing happens when i load www.mywebsite.com/logz.php (logz.php is the name of the file i've put at the same level as cron.php).
Thanks in advance for your help.
Solved! Go to Solution.
Thank you for your response. I found the solution by using the cron service on my server :
curl -T /home/path-of-server/logs/transfer.log http://listener.logz.io:8021/file_upload/key-delivered-by-logz/apache_access
path-of-server = /home/website.com/log/exemple
key-delivered-by-logz = key provided by logz on your admin.
It works great, i get every log sent every 5 min.