SMB static log file

Piotr Buliński bulinskp at iem.pw.edu.pl
Mon May 18 14:01:00 GMT 2009


		
Wiadomość napisana w dniu 2009-05-18, o godz. 15:28, przez Piotr  
Buliński:

>
> Wiadomość napisana w dniu 2009-05-18, o godz. 07:42, przez Andrew  
> Bartlett:
>
>> On Sat, 2009-05-16 at 20:03 +0200, Piotr Buliński wrote:
>>> Wiadomość napisana w dniu 2009-05-16, o godz. 19:44, przez Volker
>>> Lendecke:
>>>
>>>> On Sat, May 16, 2009 at 10:23:04AM +0200, Piotr Buliński wrote:
>>>>> Hello All,
>>>>>
>>>>> I am wondering if it would be possible to do anything with hard  
>>>>> coded
>>>>> log.smbd i log.nmbd in samba. It is really annoying when I do not
>>>>> want
>>>>> to have anything logged into files (syslog only = yes), but samba
>>>>> every restart create log files.
>>>>>
>>>>> I know this is because reopen_logs and DEBUG(....) are called  
>>>>> before
>>>>> configuration load, so there is no way to make it through
>>>>> configuration file.
>>>>>
>>>>> But maybe it would be possible to modify reopen_logs() and/or add
>>>>> another flag to daemon, that prevent from creating log.* files  
>>>>> (send
>>>>> to syslog?)?
>>>>>
>>>>> I really would like to discuss about this issue with You and find
>>>>> some
>>>>> constructive solution.
>>>>
>>>> Would a cmd line parameter to the daemons help? That should
>>>> set Globals.bSyslogOnly to true very early.
>>>>
>>>> Can you provide a patch to do this?
>>>>
>>>> Volker
>>>
>>> It would be great to set it from command line.
>>> I could try to do this to end of weekend.
>>
>> While I realise it would not be as simple as a quick patch for  
>> this, I
>> note that the Samba4 --option= command line syntax would probably  
>> handle
>> this.
>>
>> Unfortunately the parameter systems diverged in two different  
>> directions
>> after Samba4 branched (so it's not a trivial merge), but I just  
>> wanted
>> to mention this as a long-term possibility.
>>
>> Andrew Bartlett
>
> It is not so easy. I need more time to better understand mechanism  
> of debuging in samba. Then I'll try to make a patch.

I think changes should be made to debugging subsytem only ( lib/ 
debug.c ). IMO reasonable solution would be checking if samba is  
configured with syslog support and then daemon will choose write to  
syslog or to file/stdout.

if( lp_loaded ) {
	Debug write messagess accordingly to configuration parameters in  
smb.conf
} else {
	if( WITH_SYSLOG ) {
		Debug write message to syslog
	} else {
		Debug write message to file, or maybe it would be better writing to  
stdout/stderr?
	}
}

So the only difference should be visible when daemons starts, after  
parsing configuration samba behave as it is in smb.conf.

Good thing about that is when user build samba with syslog support  
(that probably mean, he want to use syslog) then messages go straight  
to syslog. In other cases it could behave like now - write to some  
hardcoded files - or write to stdout.


This would be preety simple to implement and solves problem with  
syslog in global context.

What do You think about this?

-- 
Piotr Buliński
http://piotr.bulinski.pl


More information about the samba-technical mailing list