WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [SOLVED] Samba not generating logs  (Read 15408 times)

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
[SOLVED] Samba not generating logs
« on: December 15, 2011, 10:01:59 PM »
Hi all,

I think there might be a problem with the current Samba.tcz file

My samba system was working fine, and then I upgraded.

Now my samba logs are not being generated

I've been banging my head on this for too long and need a break, I'll include samba versions / smb.conf files and effects in my next post.

« Last Edit: December 16, 2011, 10:53:53 PM by remus »
Live long and prosper.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11518
Re: Samba not generating logs
« Reply #1 on: December 16, 2011, 01:08:39 AM »
Hi remus
Be it a BIOS, an application, or anything else, as general rule I don't upgrade it unless it fixes
something. Regardless of whether I follow this rule or decide to break it, I always make sure I
have a downgrade strategy in place before proceeding. It's good idea to ask yourself why you
are upgrading. Is it to fix something, to get some needed functionality, or simply because a new
version is available? The latter, in my opinion, is never a good reason, and in some cases just
adds features you don't need and consumes more resources.
This is also worth keeping in mind when requesting an extension update because a new version
of the application was released.

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Re: Samba not generating logs
« Reply #2 on: December 16, 2011, 02:08:44 AM »
Good Points Rich,

I've been:
- getting my samba file server setup and doing everything that I want.
- then making a backup of my tce folder
- wiping the original tce dir from my flash drive
- and starting again.

This procedure allows me to use drills/repetition to learn and remember new things.
So I'm lucky that I have a few tce folders now and checking the file size's of the Samba.tcz files in my backups is how I spotted that I must have a new version.

My setup routine is always the same, with identical config files.

Heres my smb.conf file
-----------------------------
[global]
log file = /usr/local/etc/samba/log/smbd.log
max log size = 50
workgroup = workgroup
netbios name = office

[Funding]
Comment = Funding Share
path = /fileserver/funding
read only = no
guest ok = no
force user = username
force group = groupname
-----------------------------

I was figuring out how to stop cups crap from spamming my samba log file (cups is not even installed) when I noticed that there were no entries in the logs of things like invalid usernames/passwords, valid access, and disconnections.
Live long and prosper.

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Re: Samba not generating logs
« Reply #3 on: December 16, 2011, 03:55:35 AM »
Heres what my testing turned up.

Older samba3.tcz file
- File Size : 28.7MB
- Samba Version : 3.4.5
- User access details being logged to smbd.log :)

Newer samba3.tcz file
- File Size : 33.4MB
- Samba Version : 3.6.1
- User access details NOT being logged to smbd.log :(
Live long and prosper.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14756
Re: Samba not generating logs
« Reply #4 on: December 16, 2011, 04:48:08 AM »
I was asked to update the samba extension, so I did.

You can use the old extension from the tc-3 repo - I didn't disable logging in the new extension, so maybe a new smb.conf entry is required to enable it?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14756
Re: Samba not generating logs
« Reply #5 on: December 16, 2011, 06:24:59 AM »
I just checked, using samba-3.6.1, I have a /var/log/samba-log.smbd - is this what you're speaking of?

This is using the smb.conf entry "log file = /var/log/samba-log.%m"


Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Re: Samba not generating logs
« Reply #6 on: December 16, 2011, 09:08:01 AM »
Thanks for your input Juanito,

I've done a bit more testing and can report the following.

If the log files did not already exists, they are created:
- When accessing the samba share with any combination of either valid or invalid (host name or ip address, share name, username, password)
This create of the log file is good, however the log files contain no data, and shows as having 0 file size.

I've tried the following "log file =" variations with the same results.

log file = /usr/local/etc/samba/log/smbd.%m
log file = /usr/local/etc/samba/log/smbd.log

log file = /var/log/samba-log.%m
log file = /var/log/samba-log.log

Do you think that some of the other extensions I have installed are conflicting ?
So in the morning I'll backup my tce folder and start from scratch, but this time ONLY install samba, and nano which is the text editor I use.
Live long and prosper.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14756
Re: Samba not generating logs
« Reply #7 on: December 16, 2011, 10:03:20 AM »
This is what I see:
Code: [Select]
$ ls -l /var/log/samba*
-rw-r--r--    1 root     root             0 Dec 16 07:50 /var/log/samba-log.192.168.1.102
-rw-r--r--    1 root     root             0 Dec 15 21:10 /var/log/samba-log.192.168.1.105
-rw-r--r--    1 root     root           614 Dec 15 18:35 /var/log/samba-log.smbd

where:
Code: [Select]
$ cat /var/log/samba-log.smbd
[2011/12/15 18:35:56.151100,  0] lib/util_sock.c:602(open_socket_in)
  open_socket_in(): socket() call failed: Address family not supported by protocol
[2011/12/15 18:35:56.151157,  0] smbd/server.c:569(smbd_open_one_socket)
  smbd_open_once_socket: open_socket_in: Address family not supported by protocol
[2011/12/15 18:35:56.164919,  0] lib/util_sock.c:602(open_socket_in)
  open_socket_in(): socket() call failed: Address family not supported by protocol
[2011/12/15 18:35:56.165051,  0] smbd/server.c:569(smbd_open_one_socket)
  smbd_open_once_socket: open_socket_in: Address family not supported by protocol

I have 168 extensions loaded...

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Re: Samba not generating logs
« Reply #8 on: December 16, 2011, 10:40:35 PM »
Hi Juanito,

When a user makes valid access to a samba share, I normally get a record of it in the log file.

I've setup a fresh tinycore system in VM Workstation using tinycore 4.1
I've installed
- Samba 3.4.5
- nano
- shadow-utils

Once everything is setup I get the following log file entries
Code: [Select]
[2011/12/17 12:04:38,  0] printing/print_cups.c:103(cups_connect)
  Unable to connect to CUPS server localhost:631 - Connection refused
[2011/12/17 12:04:38,  0] printing/print_cups.c:103(cups_connect)
  Unable to connect to CUPS server localhost:631 - Connection refused
[b][2011/12/17 12:05:54,  1] smbd/service.c:1047(make_connection_snum)
  office (192.168.2.128) connect to service funding initially as user johns (uid=1002, gid=500) (pid 933)[/b]
[2011/12/17 12:06:02,  1] smbd/service.c:1226(close_cnum)
  office (192.168.2.128) closed connection to service funding
[b][2011/12/17 12:07:40,  1] smbd/service.c:1047(make_connection_snum)
  nb1 (192.168.2.1) connect to service funding initially as user johns (uid=1002, gid=500) (pid 946)[/b]
[2011/12/17 12:10:31,  0] printing/print_cups.c:103(cups_connect)
  Unable to connect to CUPS server localhost:631 - Connection refused
[2011/12/17 12:10:31,  0] printing/print_cups.c:103(cups_connect)
  Unable to connect to CUPS server localhost:631 - Connection refused

There are entries in the log about user johns access, I do not get these user access entries with samba 3.6.1 tcz file.

I have had a crack at the script program so you can see how I set this up, hope its ok, i've never used it before. You can review my command line record with the attached typescript file
« Last Edit: December 16, 2011, 10:43:02 PM by remus »
Live long and prosper.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11518
Re: Samba not generating logs
« Reply #9 on: December 16, 2011, 10:41:38 PM »
Hi remus
What happens if you add  log level = 2

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Re: Samba not generating logs
« Reply #10 on: December 16, 2011, 10:53:20 PM »
Solved !!!

Yep, if I add 'log level = 2' then the logs become much more detailed.

You were right Juanito,
Quote
I didn't disable logging in the new extension, so maybe a new smb.conf entry is required to enable it?

My humble apologies for suggesting there was a problem with the tcz file you posted.

I'll RTFM before making assumptions in future ;)
Live long and prosper.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11518
Re: [SOLVED] Samba not generating logs
« Reply #11 on: December 16, 2011, 10:58:57 PM »
Hi remus
Do me a favor and try it with  log level = 1  and tell me what happens.

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Re: [SOLVED] Samba not generating logs
« Reply #12 on: December 17, 2011, 07:05:35 AM »
Hi Rich,

log level = 1
Produces log files when user makes a valid login attempt.

log level = 2
Produces more log files when user makes a valid login attempt.

Not using 'log level =' Produces no record when a user makes a valid logon to the server. But some details are logged that appear to be about the general status of the server
Live long and prosper.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11518
Re: [SOLVED] Samba not generating logs
« Reply #13 on: December 17, 2011, 09:22:18 AM »
Hi remus
Thanks for doing those tests. I found some documentation that claimed log level defaulted to 1 and
some that claimed it defaulted to 0 with no mention of which version of Samba. I also took a look
through the change logs for Samba and there was no mention of log levels default value being
changed mentioned. It looks like Samba 3.6.1 is defaulting to 0. The documentation warns that this
setting can impact performance and recommends it not be set higher than 2 for normal use.

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Re: [SOLVED] Samba not generating logs
« Reply #14 on: December 17, 2011, 07:45:26 PM »
Hi Rich,
Thanks for checking the docs.
I think I'll be happy with log level = 2.
I found an article a while back about modifying the logs that samba generates by hacking behind the scenes files.

I'll see if I can find it again.
Live long and prosper.