I always have someone tell me about issues with my server when I am not at home or able to view the logs. So I figured out a really easy way to make them securely available on my desktop and android phone.
Just in case someone else finds this useful I figured I would post my solution (which I am sure there is a better way already):
- Setup an FTP server on PMS server and setup router to forward ports.
- Setup a script to copy the PMS logs you want to access anywhere to the root FTP folder
- Connect and download files to whatever devices you want
I wrote a C# app that reads the logs without locking them so PMS does not run into issues writing to a locked file. It also looks for some key words in each line (errors and critical things) and writes them to a shorter file. This happens every 30 seconds so I don’t have to wait too long to see the events in the ftp server.
My desktop app and android app connect to the FTP server download the files and load them to an arraylist. I had to use Apache.Common.FtpClient for ftping and Apache.Common.io.fileutils for a single line of code to read the files into an array on Android because I am lazy.
Added a keyword search to both apps which just loops through the arrays copying lines to a new array that match the keywords then updating the views with newly created array in real time.
The android app is the better of the two at this time because of the Apache libraries where the C# just initiates a batch file which is much more limited.
Windows App
Android App with a couple thousand lines Androids ListView has no performance issues
Real time filtering which was very easy to do
