04-05-2020
Thank you Peasant,
Achieved the solution by another way..
added "PROMPT_COMMAND='history -a >(tee -a ~/.bash_history | logger -t "$USER[$$] $SSH_CONNECTION")'" in /etc/profile and getting logs stored in messages file in /var/log directory...thank you
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi I have a command in a script .
/usr/bin/iostat -E
I would like to place an entry in /var/adm/messages (via syslog) as a daemon.notice using the logger command but i just cant work out the syntax for this , do I pipe the output of iostat into logger? or is it redirected...can somebody give me... (1 Reply)
Discussion started by: hcclnoodles
1 Replies
2. UNIX for Advanced & Expert Users
Generally(at least on AIX5.3, Solaris9, OS X)'logger' command would create syslog messages which carry <login name> . On Solaris9, I have experienced two circumstances in which 'logname' command fails. In this circumstance I saw the 'logger' command generated syslog messages which carry... (0 Replies)
Discussion started by: masaki
0 Replies
3. Shell Programming and Scripting
I am working on a script that checks two arguments at the command line. The first argument is a search pattern, the second can be a file or a directory, if it is a file a second script is called that checks it for the search pattern. If the second argument is a directory, it checks for the search... (5 Replies)
Discussion started by: Breakology
5 Replies
4. AIX
Hello Friends,
I had enabled the audit and configured for sysadmin user alone in audit config file. but the audit starts logging for root user alone.
Attached the conf file. I want the aduit to record only for sysadmin activities..
need your expertise and help in solving the issue. (1 Reply)
Discussion started by: kmvinay
1 Replies
5. Shell Programming and Scripting
I am a bash beginner and I need to write an script to check my users login time. This has to be in a format of :
This script has to work on a server to check all the users. I know that I have to use "last" command but I have no idea how to do it.
any assistance is appreciated.
Thanks (17 Replies)
Discussion started by: bashily
17 Replies
6. Shell Programming and Scripting
i'm trying to write a bash script that executes a mysql statement
mysql -sN -e INSERT INTO "$database"."$tableprefix"users (var1, var2,var3) VALUES (123, '1','')
i don't know where to put the quotes
it doesnt work with this one: `
it seems i can only put double quotes around the... (0 Replies)
Discussion started by: vanessafan99
0 Replies
7. Shell Programming and Scripting
I'm running mysql in a bash script
mysql <<EOF
query
EOF
one query is like this:
UPDATE $dbname.$prefix"config" SET value = $var WHERE "$prefix"config.name = 'table colname';
with variable
but it's giving an error
i'm not sure what to put for
"$prefix"config.name
the table... (3 Replies)
Discussion started by: vanessafan99
3 Replies
8. Shell Programming and Scripting
ls -l /md01/EL/MarketData/inbound/ststr/INVENTORY* |tail -5 |awk '{ print $5,$6,$7,$8,$9 }'If I run the above from the command line the output to md_email is formatted correctly as
78213497 May 1 12:50 /md01/EL/MarketData/inbound/ststr/INVENTORY.20120430.PINESTREET.CSV.done
77904740 May 2... (3 Replies)
Discussion started by: smenago
3 Replies
9. Shell Programming and Scripting
I use the snippet below in /etc/profile on RHEL Linux to capture command line logging and it all works well and good.
Now I'd like to pipe the same output from script through the logger command so it all gets logged to syslog.
The only additional code I've added is in bold below (|... (4 Replies)
Discussion started by: woodson2
4 Replies
10. Shell Programming and Scripting
Hi,
On RHEL 7.2, I created below script in cronjob for every minute. If this process is found to be not running, it should record message in /var/adm/xymessages, start it and send email.
#!/bin/bash
source /export/home/prodadm/.bash_profile
if ;
then
... (8 Replies)
Discussion started by: ron323232
8 Replies
logger(1B) SunOS/BSD Compatibility Package Commands logger(1B)
NAME
logger - add entries to the system log
SYNOPSIS
/usr/ucb/logger [-f filename] [-i] [-p priority] [-t tag] mm [message]...
DESCRIPTION
The logger utility provides a method for adding one-line entries to the system log file from the command line. One or more message argu-
ments can be given on the command line, in which case each is logged immediately. If message is unspecified, either the file indicated with
-f or the standard input is added to the log. Otherwise, a filename can be specified, in which case each line in the file is logged. If
neither is specified, logger reads and logs messages on a line-by-line basis from the standard input.
OPTIONS
The following options are supported:
-i Log the process ID of the logger process with each line.
-f filename Use the contents of filename as the message to log.
-p priority Enter the message with the specified priority. The message priority can be specified numerically, or as a facility.level
pair. For example, `-p local3.info' assigns the message priority to the info level in the local3 facility. The default pri-
ority is user.notice.
-t tag Mark each line added to the log with the specified tag.
EXAMPLES
Example 1: Logging a message
The command:
example% logger System rebooted
will log the message `System rebooted' to the facility at priority notice to be treated by syslogd as other messages to the facility notice
are.
Example 2: Logging messages from a file
The command:
example% logger -p local0.notice -t HOSTIDM -f /dev/idmc
will read from the file /dev/idmc and will log each line in that file as a message with the tag `HOSTIDM' at priority notice to be treated
by syslogd as other messages to the facility local0 are.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWscpu |
+-----------------------------+-----------------------------+
SEE ALSO
syslogd(1M), syslog(3C), attributes(5)
SunOS 5.10 14 Sep 1992 logger(1B)