This Tutorial will allow you to create a custom script that you can execute from the browser URL.
What do you need in order to perform this tutorial
Download and Install SiteCore PowerShell Extension. Access it from the SiteCore Desktop.
Add a small custom Script:
This script will give you last 20 lines of the log file. Or you can specify a different log file name and different length of lines. Commands are below
if($length -eq $null){
$length = 30
}if($logType -eq $null){
$logType = “log”
}Get-ChildItem “$($SitecoreLogFolder)\$LogType*.*” |
Sort-Object -Descending LastWriteTime |
Select-Object -First 1 |
Get-Content -Tail $length
In order for this to work. You need to enable restfulv2 in your Cognifide.PowerShell.config. which is located in Website\App_config\Include\Cognifide.PowerShell.config
<restfulv2 enabled=”true” requireSecureConnection=”false“>
Commands that you can run from the browser while logged in are the following:
- https://yourwebsite/-/script/v2/master/ShowLogTail
- https://yourwebsite/-/script/v2/master/ShowLogTail?length=30
- https://yourwebsite/-/script/v2/master/ShowLogTail?logType=Publishing
- https://yourwebsite/-/script/v2/master/ShowLogTail?length=30&logType=Publishing
Hopefully this helps.
If you have any questions ask me on tmamedbekov or comment below.