[Samba] SAMBA: Share specific log files

Srini v.vvsrini at gmail.com
Thu May 17 00:26:07 GMT 2007


No. They dont seem to work for being used in log file. Apparently
these can not be used for log file names in the configuration file but
for other execution scripts (preexec and postexec).

Srini

On 5/16/07, Cleber P. de Souza <cleberps at gmail.com> wrote:
> The share variables %P and %S don't help you?
> Like this:
> log file = /var/log/samba/%S.log
>
>
> On 5/16/07, Srini <v.vvsrini at gmail.com> wrote:
> > Hi all,
> >
> > We are trying to print the log messages pertaining to each share in a
> > different log file for auditing purposes.
> >
> > We are using Samba v3.0.20b.
> >
> > We are trying to modify the file
> > smbd/service.c::make_connection_snum() function by changing the log
> > file full path. The code changes that is done are as follows:
> >
> >        char logfilefullpath[70];
> >        char sharename[256];
> >
> >        safe_strcpy_fn (__FILE__, __LINE__ ,logfilefullpath,
> > "/log/sharenet/", sizeof ("/log/sharenet/"));
> >        safe_strcat_fn
> > (__FILE__,__LINE__,logfilefullpath,lp_servicename(snum),
> > sizeof("/log/sharenet/")+sizeof(lp_servicename(snum)));
> >        safe_strcat_fn (__FILE__,__LINE__,logfilefullpath,".log",
> > sizeof("/log/sharenet/")+sizeof(lp_servicename(snum))+sizeof(".log"));
> >
> >        safe_strcpy_fn
> > (__FILE__,__LINE__,sharename,lp_servicename(snum),
> > sizeof("/log/sharenet/")+sizeof(lp_servicename(snum)));
> >        lp_set_logfile(logfilefullpath);
> >        safe_strcpy_fn
> > (__FILE__,__LINE__,debugf,logfilefullpath,sizeof(logfilefullpath));
> >
> >        if( DEBUGLVL( IS_IPC(conn) ? 3 : 1 ) ) {
> >                dbgtext( "%s (%s) ", get_remote_machine_name(),
> > conn->client_address );
> >                dbgtext( "%s", srv_is_signing_active() ? "signed " : "");
> >                dbgtext( "connect to service %s ", lp_servicename(snum) );
> >                dbgtext( "initially as user %s ", user );
> >                dbgtext( "(uid=%d, gid=%d) ", (int)geteuid(), (int)getegid() );
> >                dbgtext( "(pid %d)\n", (int)sys_getpid() );
> >        }
> >
> > We have done a similar code snipped in the relevant portion of the
> > code in open_file part of Samba as well. However we find that the log
> > file randomly gets written to the default log file (log file= variable
> > in smb.conf) or sometimes to the share specific log file (that we have
> > attempted above). It looks like that this was a buffering problem and
> > so we tried to put in dbgflush() routine as well after calling
> > dbgtext() macro. Still with no success...
> >
> > Has anyone tried to modify the source code to generate share specific
> > log trails - either by modifying the source code or without? If so,
> > can the experts guide us on this?
> >
> > Thanks in advance for all your inputs and help,
> >
> > Srini
> > --
> > To unsubscribe from this list go to the following URL and read the
> > instructions:  https://lists.samba.org/mailman/listinfo/samba
> >
>
>
> --
> ***
> Cleber P. de Souza
>


More information about the samba mailing list