Hi!

We had user requests (fate#100386) to provide the logging that would be 
readable to users. Such logs should provide the information what certain YaST 
action is really doing to the system and exclude all the internal debug info 
our y2logs are full of.

Martin and Stano created some concept and added new logging functions 
y2usernote and y2useritem. These log to the new log 
file, /var/log/YaST2/y2changes (or $HOME/.y2changes).

The question which is still not resolved is how should we use these functions? 
Which events our modules produce should provide description as "note" and 
which should provide "items"? 
What level of complexity should be presented to user? Should we log the real 
actions, just like commands passed to system agent or rather the explanations 
of the actions taken? Or both?

Let's go to the example. I've added these functions to yast2-users, it's in 
svn already (update of perl-bindings is needed).

At first, I started logging actions done in Write function. I deleted one user 
and renamed another. See the first y2changes file attached or look here 
http://pastebin.com/m2c5ec8fe.

Now, it is not bad, but the item "File written: '/etc/group'" doesn't give 
much detailed info about what was done to that file. Stano proposed printing 
the diffs of the original and modified one: see y2changes-with-diffs file (or 
look at http://pastebin.com/m3bac2086)

Here, the user knows more about the real changes, but the log file is getting 
a bit less readable again... still I think I'd prefer it.

You could see on examples that I don't really use the advantage of having 2 
logging functions. AFAIK Martin's original proposal was to use items to tell 
what actions are we going to perform and notes to log the details of such 
action. This is hardly achievable in yast2-users module (may be better with 
others), since at the time of writing we don't know the "user actions" taken, 
this is the info which is known when user is clicking in the UI (*). So 
another idea is to log directly when users is using UI and not at the time of 
write. See the last example, y2changes-UI (or http://pastebin.com/m23a3debb). 
This is not a full log this time, just part of it.

I think the last method is getting more talkative and actually is not more 
helpful.

So - comments? Proposals?

Jiri

(*) Actually it would need to be cached during the UI-clicking and logged at 
the time of writing only if user doesn't cancel the actions.

-- 
Jiri Suchomel

SUSE LINUX, s.r.o.                            e-mail: [email protected]
Lihovarská 1060/12                            tel: +420 284 028 960
190 00 Praha 9, Czech Republic                http://www.suse.cz
2009-02-05 15:15:55 <item> rivendell User and Group Management module started
2009-02-05 15:16:12 <note> rivendell File written: '/etc/group'
2009-02-05 15:16:12 <note> rivendell User pre-deletion script called: 
'/usr/sbin/userdel-pre.local cc 1003 100 /local/home/cc'
2009-02-05 15:16:12 <note> rivendell File written: '/etc/passwd'
2009-02-05 15:16:12 <note> rivendell User 'aa' renamed to 'bb'
2009-02-05 15:16:12 <note> rivendell Home directory moved: '/bin/mv 
/local/home/aa /local/home/bb'
2009-02-05 15:16:12 <note> rivendell File written: '/etc/shadow'
2009-02-05 15:16:12 <note> rivendell nscd cache invalidated: '/usr/sbin/nscd -i 
passwd'
2009-02-05 15:16:12 <note> rivendell nscd cache invalidated: '/usr/sbin/nscd -i 
group'
2009-02-05 15:16:12 <note> rivendell Group 'dialout' modified
2009-02-05 15:16:12 <note> rivendell Group 'video' modified
2009-02-05 15:16:12 <note> rivendell Home directory removed: '/bin/rm -rf 
/local/home/cc'
2009-02-05 15:16:12 <note> rivendell User post-deletion script called: 
'/usr/sbin/userdel-post.local cc 1003 100 /local/home/cc'
2009-02-05 15:16:13 <item> rivendell User and Group Management module finished

2009-02-09 10:05:50 <item> rivendell User and Group Management module started
2009-02-09 11:05:49 <note> rivendell Backup created: '/bin/cp /etc/group /etc/group.YaST2save'
2009-02-09 11:05:49 <note> rivendell File written: '/etc/group'
2009-02-09 11:05:49 <note> rivendell Comparing original and new version:
--- /etc/group.YaST2save	2009-02-09 11:05:49.000000000 +0100
+++ /etc/group	2009-02-09 11:05:49.000000000 +0100
@@ -8,3 +8,3 @@
 daemon:x:2:
-dialout:x:16:bb,hh,linux,zz
+dialout:x:16:aa,hh,linux
 disk:x:6:
@@ -45,3 +45,3 @@
 vboxusers:!:113:jsuchome
-video:x:33:bb,hh,linux,zz
+video:x:33:aa,hh,linux
 wheel:x:10:
`
2009-02-09 11:05:49 <note> rivendell User pre-deletion script called: '/usr/sbin/userdel-pre.local zz 1003 100 /local/home/zz'
2009-02-09 11:05:49 <note> rivendell Backup created: '/bin/cp /etc/passwd /etc/passwd.YaST2save'
2009-02-09 11:05:49 <note> rivendell File written: '/etc/passwd'
2009-02-09 11:05:49 <note> rivendell Comparing original and new version:
--- /etc/passwd.YaST2save	2009-02-09 11:05:49.000000000 +0100
+++ /etc/passwd	2009-02-09 11:05:49.000000000 +0100
@@ -28,6 +28,5 @@
 wwwrun:x:30:8:WWW daemon apache:/var/lib/wwwrun:/bin/false
-bb:x:1002:100:AAA:/local/home/bb:/bin/bash
+aa:x:1002:100:AAA:/local/home/aa:/bin/bash
 hh:x:1000:100:hhh:/local/home/hh:/bin/bash
 linux:x:1001:100:linux:/local/home/linux:/bin/bash
-zz:x:1003:100:zz:/local/home/zz:/bin/bash
 +::::::
`
2009-02-09 11:05:49 <note> rivendell User 'bb' renamed to 'aa'
2009-02-09 11:05:49 <note> rivendell Home directory moved: '/bin/mv /local/home/bb /local/home/aa'
2009-02-09 11:05:49 <note> rivendell Backup created: '/bin/cp /etc/shadow /etc/shadow.YaST2save'
2009-02-09 11:05:49 <note> rivendell File written: '/etc/shadow'
2009-02-09 11:05:49 <note> rivendell nscd cache invalidated: '/usr/sbin/nscd -i passwd'
2009-02-09 11:05:49 <note> rivendell nscd cache invalidated: '/usr/sbin/nscd -i group'
2009-02-09 11:05:49 <note> rivendell Group 'dialout' modified
2009-02-09 11:05:49 <note> rivendell Group 'video' modified
2009-02-09 11:05:49 <note> rivendell Home directory removed: '/bin/rm -rf /local/home/zz'
2009-02-09 11:05:49 <note> rivendell User post-deletion script called: '/usr/sbin/userdel-post.local zz 1003 100 /local/home/zz'
2009-02-09 11:05:50 <item> rivendell User and Group Management module finished
2009-02-06 15:54:02 <item> rivendell User and Group Management module started   
2009-02-06 15:54:11 <note> rivendell (UI info) User 'bb' removed from group 'dia
lout'                                                                           
2009-02-06 15:54:11 <note> rivendell (UI info) User 'aa' added to group 'dialout
'                                                                               
2009-02-06 15:54:11 <note> rivendell (UI info) User 'bb' removed from group 'vid
eo'                                                                             
2009-02-06 15:54:11 <note> rivendell (UI info) User 'aa' added to group 'video'
2009-02-06 15:54:11 <note> rivendell (UI info) User 'bb' renamed to 'aa'        
2009-02-06 15:54:11 <item> rivendell (UI info) User modified: 'aa'
2009-02-06 16:03:10 <item> rivendell User and Group Management module finished

Reply via email to