CSIA AN
asked on
Issues when use LOG function from thread "http://www.experts-exchange.com/questions/28926237/send-ksh-history-to-syslogd-on-AIX.html"
Hi wmp,
We were asked to send to syslog all HSK history from users. This was the first thread we created:
https://www.experts-exchange.com/questions/28926237/send-ksh-history-to-syslogd-on-AIX.html
Then, we had some errors, that were fixed here:
https://www.experts-exchange.com/questions/28928201/log-not-found-on-some-commands.html
But, now we have found another issue on some commands, for examplewhen execute chfs to extend /FS filesystem, we got this:
If I run debug KSH on the same command:
Similar errors ocurs when execute shutdown command.
Remember, we have created this LOG function on /etc/profile and on every user's home directory .kshrc. I mean:
On /etc/profile we added at the end of file:
And inside every /home/user/.kshrc, we added
When /tools/scripts/kshrc/kshrc .ksh has this code:
Can you help us to fix this new issue?
Thanks tons!
We were asked to send to syslog all HSK history from users. This was the first thread we created:
https://www.experts-exchange.com/questions/28926237/send-ksh-history-to-syslogd-on-AIX.html
Then, we had some errors, that were fixed here:
https://www.experts-exchange.com/questions/28928201/log-not-found-on-some-commands.html
But, now we have found another issue on some commands, for examplewhen execute chfs to extend /FS filesystem, we got this:
(AIX):[root] / -> chfs -a size=+1M /FS
Usage: extendlv [-a IntraPolicy] [-e InterPolicy] [-m MapFile]
[-s Strict] [-u UpperBound] LVname NumberOfLPs [PVname...]
Extends the size of a logical volume.
If I run debug KSH on the same command:
(AIX):[root] / -> ksh -vx chfs -a size=+1M /FS
. /tools/scripts/kshrc/kshrc.ksh
+ . /tools/scripts/kshrc/kshrc.ksh
+ typeset -xf log
+ trap log DEBUG
+ log
chfs "$@"+ chfs -a size=+1M /FS
Usage: extendlv [-a IntraPolicy] [-e InterPolicy] [-m MapFile]
[-s Strict] [-u UpperBound] LVname NumberOfLPs [PVname...]
Extends the size of a logical volume.
Similar errors ocurs when execute shutdown command.
Remember, we have created this LOG function on /etc/profile and on every user's home directory .kshrc. I mean:
On /etc/profile we added at the end of file:
function log
{
typeset -i stat=$?
if [[ $LOGNAME = @(user1|user2) ]] ; then return; fi
typeset x
x=$(fc -ln -0)
echo $x | grep -q "daemon.info" || logger -p daemon.info -t "SHELL: $LOGNAME $$" Status $stat PWD $PWD \'${x# }\'
}
typeset -xf log
trap log DEBUG
export ENV=$HOME/.kshrc
And inside every /home/user/.kshrc, we added
(AIX):[root] / -> cat /home/israel/.kshrc
. /tools/scripts/kshrc/kshrc.ksh
When /tools/scripts/kshrc/kshrc
(AIX):[root] / -> cat /tools/scripts/kshrc/kshrc.ksh
function log
{
typeset -i stat=$?
if [[ $LOGNAME = @(user1|user2) ]] ; then return; fi
typeset x
x=$(fc -ln -0)
echo $x | grep -q "daemon.info" || logger -p daemon.info -t "SHELL: $LOGNAME $$" Status $stat PWD $PWD \'${x# }\'
}
typeset -xf log
trap log DEBUG
Can you help us to fix this new issue?
Thanks tons!
In the meantime I've been able to reproduce this issue. I don't see this "chfs "$@"+ " thing, but anyway.
It seems that our famous logging function would fail as soon as a script (extendlv) is called by a binary (chfs).
I don't have a real idea what's going on here.
I suspect that the cause is not in the logging function itself but rather due to the signal trapping.
I'll try to find out a bit more, but I'm not really optimistic that we can find a solution.
Let's see.
It seems that our famous logging function would fail as soon as a script (extendlv) is called by a binary (chfs).
I don't have a real idea what's going on here.
I suspect that the cause is not in the logging function itself but rather due to the signal trapping.
I'll try to find out a bit more, but I'm not really optimistic that we can find a solution.
Let's see.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi WMP,
Sorry the delay. Now I see extendlv script is the cause of the error with RC 127. I think it should be similar with shutdown script.
But it's curious if you're not root user it works. Let me explain you. We have configured RBAC for admin users, to avoid use root user, and in this case chfs and extendlv works well.
See an example, run the same command using my user with RBAC role loaded:
For now we're going to open a PMR with IBM to see if they can help us.
Thanks much! Have a greate weekend!!
Sorry the delay. Now I see extendlv script is the cause of the error with RC 127. I think it should be similar with shutdown script.
But it's curious if you're not root user it works. Let me explain you. We have configured RBAC for admin users, to avoid use root user, and in this case chfs and extendlv works well.
See an example, run the same command using my user with RBAC role loaded:
():[israel] /home/israel -> ksh -vx chfs -a size=+1M /CORES
. /tools/scripts/kshrc/kshrc.ksh
+ . /tools/scripts/kshrc/kshrc.ksh
+ typeset -xf log
+ trap log DEBUG
+ log
chfs "$@"+ chfs -a size=+1M /CORES
Filesystem size changed to 524288
For now we're going to open a PMR with IBM to see if they can help us.
Thanks much! Have a greate weekend!!
Oh dear, this makes it even more puzzling!
I'm really curious what IBM might say (if anything at all)!
Have a very nice weekend, too!
wmp
I'm really curious what IBM might say (if anything at all)!
Have a very nice weekend, too!
wmp
ASKER
Hi again,
I've been out of office last week. Let's open a PMR to see if there is any solution to our issue.
I've been out of office last week. Let's open a PMR to see if there is any solution to our issue.
ASKER
Hi wmp,
Back again ;)
After a while IBM has said:
The issue is NOT related to the AIX commands,its due to the script of LOG function which actually
corrupting the $? value which has global scope.Please modify the script without corrupting $?.
I couldn't get what is wrong in the script though i suspect issue with back ticks "`".
So, there's no way to fix the issue with LOG function. IBM recommend to use auditbin to audit KSH commands.
Have a nice weekend!
Back again ;)
After a while IBM has said:
The issue is NOT related to the AIX commands,its due to the script of LOG function which actually
corrupting the $? value which has global scope.Please modify the script without corrupting $?.
I couldn't get what is wrong in the script though i suspect issue with back ticks "`".
So, there's no way to fix the issue with LOG function. IBM recommend to use auditbin to audit KSH commands.
Have a nice weekend!
ASKER
Thanks!
Strange thing, too, that the "Usage" message would mention "extendlv" instead of "chfs"!
Did you set an alias for "chfs", or is it a script?
When I try to call chfs with the parameters you posted I get an "Usage" message from chfs, as expected.
What do you see in the syslog, by the way?