Score:0

JBoss CLI command running into failure

pf flag

I want to automatically delete my Wildfly logs after a certain period of time (e.g. 3 days). As I am running my application in a container which has no access to crontab, I want to do this via a JBoss Cli. I have already tried the following command, but the option seems not to be supported:

/subsystem=logging/periodic-size-rotating-file-handler=DELETELOG:add(autoflush=true,file={"relative-to"=>"jboss.server.log.dir","path"=>"deletelog.log"},suffix=".yyyy-MM-dd",append=true,rotate-size="10M",max-backup-index=3,level=DEBUG)

Currently, the above only writes an empty file without any data. I have also configured a logger and file handler which is called FILE, but which I cannot remove as it is configured as the ROOT logger.

I want to delete the log files after a certain amount of time in my application log directory with a JBoss-cli. Do you have any idea, how this can be achieved? Thank you in advance!

Romeo Ninov avatar
in flag
Can you clarify: "which has no access to crontab"?
James R. Perkins avatar
mx flag
The periodic-size-rotating-file-handler will not delete files that were rotated with a date suffix.
Hannes Oberberger avatar
pf flag
@RomeoNinov I basically cannot delete the logs from the filesystem, neither by a cronjob nor manually - therefore, I would need a cli-command
Hannes Oberberger avatar
pf flag
@JamesR.Perkins That is clear to me - but I would like to know how i can configure the periodic-size-rotating-file-handler to actually write a log for my application. So far, this has been the biggest pain point. The second one would be to remove the file handler with the date
James R. Perkins avatar
mx flag
You need to assign the handler to a logger.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.