what can be more standard than using a date variable in the log output name?
it basically doing nothing aside from using a name that switches inside the system.
not like the system can guess what date it is… it has a variable that people use for these kinds of things…
like in your log every time there is a time code, its literally using date variables to print that into the log.
this is just using those same variables on the name and thus the logs will change names depending on days… my script might not do it exactly that way.
but thats because i have to deal with docker and then cron won’t run the command because its python codes i guess…so i have to move the command lines out of it, and thus i use some convoluted ways of essentially writing a one line log command to docker, and then i repeat it because i don’t redirect the because if i do that i loose some functionality with docker, so i export and append the 1 minute from the last one minute ago onto my log.
like you said you wanted to redirect the logs anyways, so you don’t have to deal with the scripting.
your solution should look something like this.
this is a location and at the end there are OS date and time variables which might even follow the unix standards, so you might be able to lift it directly, but not sure… this works for me in debian linux.
you should simply use something like this
in whatever name you want to rotate
which is basically telling the system, i want a date stamp variable using %Y which is year
\ %m which is month in numbers then initials of the month would be something like %M
\ %d is ofc day and again if one makes it capital it becomes the short name for the day of the week … like say Sun for today. instead of a number.
and the $() is what contains it so stuff doesn’t become a loose mess or mistake commands for other stuff like say if out wanted to actually name your file this… or something close…
you can test this out by using something like echo i would assume.
like this in my case
echo $(date +%Y)
tell my terminal to print the year on screen in its full 4 digits
echo $(date +%Y%D)
gives me… oh right a full date in one stamp… you could essentially use that if you wanted
but the reason i wanted it to sort the Dates in the particular order is when the files are listen by alphabet then they are orderly sorted, by year,month and day, so i wrote the timestamp myself. (kinda forgot about that)
so yeah sorry if all the code confused you…
if you want to keep it as simple as possible you can ofc use something like
$(date +%D) in the name of the log file…
anyways hopes it helps…
not sure you can use / in filenames tho
the %D gives out 05/10/20
but then you just look up the $(date) pre made variables and find one that fits, or use the one i decided to make.