Hi all!
First of all, I am verry new to this forum, so I am not yet familiar with the specific rules.
I am having a problem with my interactive report. I am trying to run log parser via the exec() function to have a report. I now the command itself works, because it is now running as a batch every hour.
Could you guys help me out on this?
Here is the code:
[php]<?php
$data = array();
function safeexec($command)
{
echo $command;
// define array
exec(escapeshellcmd($command), $data, $ret); // execute command, output is array
echo “
”;if ($ret == 0) { // check status code. if successful
} else {
echo “Error in command”; // if unsuccessful display error}
foreach ($data as $line) { // process array line by line
echo “$line \n”;
}return $data;
}$commando = ““C:\Program Files (x86)\Log Parser 2.2\LogParser.exe” -i EVT “SELECT TOP 250 CASE to_date(TimeGenerated) WHEN system_date() THEN ‘Today’ ELSE to_string(to_date(TimeGenerated),‘yyyy-MM-dd MMM, ddd’) END AS logonDate, to_time(TimeGenerated) AS TimeGenerated., IP, username, logonProvider using extract_token(Strings,19,’|’) AS IP, extract_token(Strings,5,’|’) AS username, extract_token(Strings,11,’|’) AS logonProvider into C:\reports\tplFailedRemoteDesktopLoginAttempts.html from \\192.168.1.6\Security where EventID IN (4625) ORDER BY logonDate ,timeGenerated. DESC” -o:tpl -tpl:tplFailedRemoteDesktopLoginAttempts.tpl 2>&1”;
safeexec($commando);
?> [/php]