Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Bzowk
  •  Bzowk
  • Free support Topic Starter
2018-09-26T18:10:32Z
Hey Guys -

Being in IT, I am a big fan of Tasker for Android and when looking for a similar app for the PC recently, I discovered VisualCron. So far, I love it! I have already created a few profiles for my admin tasks, but hit a snag today and have a quick question, please.

Unfortunately, NGINX doesn't provide config options  which rotate log files in Windows that I can find, so I'm trying to use VisualCron. The two primary log files it uses can easily grow to be over a gigabyte each in just a few days. These files are text-based with the newest events at the bottom. Below is one of the lines from a log so you can see the formatting:
Quote:

10.25.0.56 - - [26/Sep/2018:12:38:12 -0500] "POST /api/?v1/ping HTTP/1.1" 200 400 "https://mydomain.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"



Ideally, I'd like to truncate them on a schedule so that data within which is older than 2 weeks is removed. I'd assume I would use regular expression and perhaps a variable set as the current date to delete or rewrite each log. Is this feasible without tons of work?

I'd also settle for just deleting the files on a schedule if needed and tried to do this already - however - I couldn't find out how to add a trigger or event condition where it would proceed only if the file was a over a specific size. I do see that the "Delete File" event allows you to set a condition for size, however I am wanting to set the condition on the Job level since I don't want it performing the other tasks such as stopping / starting services if nothing is going to be deleted.

Any suggestions for either / both of the tasks above? Thanks!
Sponsor
Forum information
bbusse
2018-10-29T17:59:10Z
Originally Posted by: Bzowk 

Hey Guys -
I'd also settle for just deleting the files on a schedule if needed and tried to do this already - however - I couldn't find out how to add a trigger or event condition where it would proceed only if the file was a over a specific size. I do see that the "Delete File" event allows you to set a condition for size, however I am wanting to set the condition on the Job level since I don't want it performing the other tasks such as stopping / starting services if nothing is going to be deleted.

Any suggestions for either / both of the tasks above? Thanks!



I have a quick and easy solution for the 'just deleting files' suggestion. Really, you can set the entire job to run as often as you want it to check. Once a day, once a week, etc.. your call. All you have to do is have a first task 'List Files' that has criteria for the folder and file name, with a size requirement. Simply put, on that task, if 'No Files Found' (or whatever the message is when nothing matches), have it end the job (i.e. Flow control, on Error Stop Job). Then none of the subsequent tasks (Stop service, delete file, start service) would fire. So you could run it as often as you like, unless the file you're looking for is found based on file name and size being greater than X, it'll 'run' and do nothing.

Brian
Scroll to Top