LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to send randomly named/created files to /dev/null? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-send-randomly-named-created-files-to-dev-null-4175616174/)

Robbot 10-22-2017 05:32 PM

How to send randomly named/created files to /dev/null?
 
Hi,

Was wondering if anyone can help me with sending auto-created, auto-named log files to /dev/null. I have a needed service running, but it is generating excessive log files in /var/log/share. I would normally do ln -s /dev/null logname.log, but in this case the logs would be randomly labeled like:

log-test-123
log-test-456
log-sa-678

where only the first word (log) is consistently the same. Any ideas on how I can resolve this without stopping the service? Thanks!

frankbell 10-22-2017 07:48 PM

In my experience, log files in /var/log end in the extension .log.

My first tactic would be to look at the contents of /var/log and, if none of the log files have "log" as the first three letters of their file names, consider using wild cards as in /var/log/log*. You could test by using ls, as in

Code:

ls /var/log/log*
to ensure that only the desired files are listed.

Robbot 10-22-2017 08:02 PM

ok i will try it

descendant_command 10-22-2017 08:14 PM

https://linux.die.net/man/8/logrotate

Robbot 10-22-2017 09:12 PM

thanks

ondoho 10-23-2017 12:24 AM

of course, there's a bigger question here:
why is it creating excessive logs?
why is the log rotating application, that is surely working on your system, not enough?

Robbot 10-23-2017 01:00 AM

its creating excessive logs due to a persistent error and it's really flooding that directory. The error fix is coming, but I just want /dev/null them. I don't believe that these are in a rotation as these logs would never normally generate at this rate. My main focus is to just get rid of them.

!!! 10-23-2017 01:19 AM

How about a cron that rm log-* every minute (or >it)
But lsof: if open, space won't be deallocated!!!
https://unix.stackexchange.com/quest...hole-directory

pan64 10-23-2017 03:36 AM

if they are handled by rsyslogd (or similar) you can simply filter them out. But anyway I would try to configure the app to write that errors directly into /dev/null.


All times are GMT -5. The time now is 08:58 AM.