LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-22-2017, 05:32 PM   #1
Robbot
LQ Newbie
 
Registered: Jul 2017
Posts: 19

Rep: Reputation: Disabled
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!

Last edited by Robbot; 10-22-2017 at 07:59 PM.
 
Old 10-22-2017, 07:48 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 17,412
Blog Entries: 28

Rep: Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409
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.
 
Old 10-22-2017, 08:02 PM   #3
Robbot
LQ Newbie
 
Registered: Jul 2017
Posts: 19

Original Poster
Rep: Reputation: Disabled
ok i will try it

Last edited by Robbot; 10-22-2017 at 08:09 PM.
 
Old 10-22-2017, 08:14 PM   #4
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,783

Rep: Reputation: 592Reputation: 592Reputation: 592Reputation: 592Reputation: 592Reputation: 592
https://linux.die.net/man/8/logrotate
 
Old 10-22-2017, 09:12 PM   #5
Robbot
LQ Newbie
 
Registered: Jul 2017
Posts: 19

Original Poster
Rep: Reputation: Disabled
thanks
 
Old 10-23-2017, 12:24 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 17,262
Blog Entries: 10

Rep: Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160
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?
 
Old 10-23-2017, 01:00 AM   #7
Robbot
LQ Newbie
 
Registered: Jul 2017
Posts: 19

Original Poster
Rep: Reputation: Disabled
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.

Last edited by Robbot; 10-23-2017 at 01:01 AM.
 
Old 10-23-2017, 01:19 AM   #8
!!!
Member
 
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 753

Rep: Reputation: 327Reputation: 327Reputation: 327Reputation: 327
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
 
Old 10-23-2017, 03:36 AM   #9
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,507

Rep: Reputation: 5550Reputation: 5550Reputation: 5550Reputation: 5550Reputation: 5550Reputation: 5550Reputation: 5550Reputation: 5550Reputation: 5550Reputation: 5550Reputation: 5550
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Why is there a need for /dev/null, /dev/zero and other special device (files) in /dev suttiwit Linux - General 13 08-07-2012 12:26 AM
Bash script: catch file not found error and send to /dev/null noir911 Programming 7 04-24-2010 08:37 PM
Unison has found/created odd named files. I'm also after basic syncing advice. Mysticle31 Linux - Server 0 01-16-2008 11:50 AM
Send X Windows / GUI to /dev/null? mattfr Linux - General 3 11-17-2004 07:40 AM
'Can a user be created with username as "/dev/null" in an application?' sheetal_govekar Linux - Software 1 08-25-2004 11:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration