Showing results for 
Search instead for 
Did you mean: 

samba log cleaning

Go to solution
Frequent Advisor

samba log cleaning

hi all

we are setup for log level 1 and samba server at user level with about 300 users logging in. we just want some basic logging for troubleshooting, but it generates alot of logs. does anyone know of a script that cleans, lets say yesterdays logs, etc?

thx in advance
Deoncia Grayson_1
Honored Contributor

Re: samba log cleaning

you can limit the log size in the smb.conf file.

max log size= ????

this will allow you to resrict the size of the log files
If no one ever took risks, Michelangelo would have painted the Sistine floor. -Neil Simon
Steven E. Protter
Exalted Contributor

Re: samba log cleaning

Shalom pasquale,

There is a problem in general with logging.

The default samba log creates a log for each user. This is annoying. I'd take the %m out of the log setup of smb.conf as a start and then end up with just one little log.

Log rotate is a great tool for organizing and archiving logs.

Steven E Protter
Owner of ISN Corporation
Frequent Advisor

Re: samba log cleaning


will try
eric roseme
Respected Contributor

Re: samba log cleaning

Hello Pasquale,

There is no "problem" with CIFS/Samba logging. Samba logging is very configurable, so it is easy to configure the behavior that is correct for your environment.

We set the CIFS default logging config to use "%m" because that provides the most useful logging information. If you consolidate all of the user logs into a single file, you will have difficulty associating a user/session with a particular entry, so then data will be meaningless.

At "log level = 1" the data logged is minimal, and by setting the logfile size as Deoncia suggested, you can minimize the cumulative storage space required. Or, you can set the log level to 0 (which only logs errors).

You could also write a script that does a "> log.netbiosID" or "> log.IPaddress" for every log file in the /var/opt/samba directory. Run that daily and it will clear out all logged data, but leave the files.

These methods will leave you with 300 files, or possibly 600 files (depends on how your clients are connecting), but the data that you collect will be useful. If you do not require useful log data, then you can send all log data to smbd.log.

Eric Roseme