openSUSE / supportutils

SUSE Linux Enterprise support utilities. Gathers system information.
28 stars 61 forks source link

Move client logs in samba.txt after daemon logs #107

Open jirib opened 3 years ago

jirib commented 3 years ago

IMO could we move client logs till the end of the samba.txt file? The file could be huge and sometimes searching for daemon log inside many client logs is annoying.

An example:

ls -lh samba.txt
-rw-r--r--+ 1 wwwrun www 39M Jun  9 15:09 samba.txt

# number of all logs included
grep -Po ' \K(/var/log/[^ ]+)(?=.*)' samba.txt  | wc -l
28574

# number of "client" logs
grep -Po ' \K(/var/log/samba/log\.[^ ]+)(?=.*)' samba.txt | \
  grep -P '^((?!(smbd|winbindd|wb-)).)*$' | wc -l
28549

# number of lines
 wc -l < samba.txt 
709882

# position of "non-client" logs
grep -nPo ' \K(/var/log/samba/log\.[^ ]+)(?=.*)' samba.txt | \
  grep -P '(smbd|winbindd|wb-)' | grep -v \.old$ | \
  sed -r 's/wb-(.*)/wb-<censored>/'
149941:/var/log/samba/log.smbd
150445:/var/log/samba/log.smbd_UNKNOWN_UNKNOWN
159657:/var/log/samba/log.winbindd
162911:/var/log/samba/log.wb-<censored>
171467:/var/log/samba/log.wb-<censored>
180489:/var/log/samba/log.wb-<censored>
235871:/var/log/samba/log.wb-<censored>
240121:/var/log/samba/log.wb-<censored>
246613:/var/log/samba/log.wb-<censored>
252190:/var/log/samba/log.wb-<censored>
278208:/var/log/samba/log.wb-<censored>
282410:/var/log/samba/log.wb-<censored>
325665:/var/log/samba/log.wb-<censored>
365150:/var/log/samba/log.winbindd-idmap
390960:/var/log/samba/log.wb-<censored>
400034:/var/log/samba/log.wb-<censored>
579271:/var/log/samba/log.wb-<censored>
581215:/var/log/samba/log.winbindd-dc-connect
581719:/var/log/samba/log.winbindd_UNKNOWN_UNKNOWN

As you can see one has to scroll a lot to get to some "non-client" logs.

Thus I would propose to reorder display of samba logs - first daemon logs, then "client" logs.

g23guy commented 3 years ago

Sounds good.

g23guy commented 3 years ago

After reviewing supportconfig, I just get all files in the /var/log/samba directory without regard to order. I could get the file list and search for server logs, add them, and then add all the rest after that. Which specifically are the server log filenames that need to be positioned first?

Thr3d commented 2 months ago

@jirib Can you give an example of the "client" logs you're filtering out? IIUC you want to have the daemon/sub logs like smbd|winbindd|wb- above anything else in the directory?