Closed IzumiSenaSora closed 2 years ago
Good idea. I’ll add some cleanup options.
Good idea. I’ll add some cleanup options.
Is there any news?....
I found a solution if its okay! Can you review a bit? If it is ok to apply in your work
after getting result "success"
echo $dateTime, $result >> "logs/${key}_report.log"
tail -n 1440 "logs/${key}_report.log" > "logs/${key}_report.log.tmp" && mv "logs/${key}_report.log.tmp" "logs/${key}_report.log"
It can run this tail command!... tail -n 1440 shows last 1440 lines in ".log" files!...
In a hour it runs 2 time so in 24 hour it will run 48 times So in 30 days it will run 1440 times means 1440 lines of log!... So it's still smaller file compared to 5680 lines of mine 😅😅 i am using this solution for a while! Working great!... So if you have any other solution to make it even smaller then it will be cool!
For those who run every hour instead of every 30 minutes Just need to change "1440" to "720" (whice will make ".log" file size even more smaller)
echo $dateTime, $result >> "logs/${key}_report.log"
tail -n 720 "logs/${key}_report.log" > "logs/${key}_report.log.tmp" && mv "logs/${key}_report.log.tmp" "logs/${key}_report.log"
thanks for the prodding, @IzumiSena . Updating in a few mins.
This should now be addressed. Thank you!
If Its running all day and night it will make "logs/example_report.logs" file too big with time! so can you guys add some script which will calculate days like "30 days for example" from 2021-01-01 to 2021-01-31 data is valid! and older data from 2020-12-31 will automatically remove something like this! cause website can show 30 days data only! others just doing nothing so removing them is better in my opinion!
BTW Thanks for this simple solution!