473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

STREAMS based shell logger

Hi,

I am involved right now in a project where I have to deliver a
shell logging mechanism (for solaris). The requirements where not
easy to fullfill already at the design level, here's the
requirement list:

- not deamon based (no single point of failure)
- not depending on a specific shell
- has to log only the interactive "login" sessions
(network or console)
- has to work in single user mode too
- stable solution, meaning the ssh gateway's should not
be destabilized by the logging mechanism
- the user can write but not read nor delete the log's
- two log file formats:
1. full session log per user and session
(stdin, stdout and stderr)
2. summary log, for all running sessions
(only timestamped stdin)

- and some more regarding how and where to keep the logs...

We choosed to work with C at the streams level to get wanted
results. It worked pretty well for the full logs, but somehow
I got stock with the summary logs. And here's the problem...

How do I get only the stdin (the commands the user is typing)
each one prependet with the user id and a timestamp when it was
executed from the pseudo-tty stream. The result should look
similar to this:

***
johnd Mon Aug 11 10:39:40 MEST 2003 cd /var/tmp
root Mon Aug 11 10:39:41 MEST 2003 less /etc/syslog.conf
johnd Mon Aug 11 10:39:44 MEST 2003 ls
robc Mon Aug 11 10:39:54 MEST 2003 pwd
miked Mon Aug 11 10:39:54 MEST 2003 op was4 stop
johnd Mon Aug 11 10:39:55 MEST 2003 id
johnd Mon Aug 11 10:39:57 MEST 2003 exit
***
I suppose I should duplicate stdin get is into cannonical
mode and process it line by line, generating a timestamp
and adding the user id. I would need some code examples
if possible.

By the way the logging mechanism is based on a named pipes
construct, that means in the case of the summary log obove
there's a named pipe to which the logger utility writes his
output. Another program will poll the other end of the pipe
for input, read it and write it to the logging facility.

I hope this was not too confusing, don't hesitate to ask
if something is unclear. Time is running out so I would
really apreciate some helpfull hint's as soon as possible.

manythx
Alex
Nov 13 '05 #1
1 1693
On 13 Aug 2003, Alex Honold wrote:
I am involved right now in a project where I have to deliver a
shell logging mechanism (for solaris). The requirements where not
easy to fullfill already at the design level, here's the
requirement list:


Does enabling system accoutning and/or auditing accomplish
what you need?

--
Rich Teer, SCNA, SCSA

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Laszlo | last post by:
Hi I need a GL::Logger wich implements Class::Singleton to be a singleton and Log::Log4perl to can log amy message into a file. Here is the module source:...
4
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my...
9
by: Mantorok Redgormor | last post by:
7.19.3p7 "At program startup, three text streams are predefined and need not be opened explicitly — standard input (for reading conventional input), standard output (for writing conventional...
2
by: Peter Rilling | last post by:
One nice thing about collections and arrays is that they implement the IEnumerator and IEnumerable interfaces which allow for more then one iterator to walk the list of items without affecting the...
4
by: garyjefferson123 | last post by:
Suppose I have some sort of context variable that I want to appear in log messages. E.g.: logger = logging.getLogger("somelogger") class SomeOp: def __init__(self, ctx): self.ctx = ctx def...
0
by: Maciej Gawinecki | last post by:
Hello, Recently I've interested in quering XML document streams. They can be queried in keyword- based manner (non-structural queries), as the authors of the article "Semantic Search over XML...
7
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
1
by: Matimus | last post by:
Yes but in the other hand :http://docs.python.org/library/logging.html#logger-objects That is part of the power of the logging module. If you ask for a logger of the same name in two different...
0
by: archwn | last post by:
Dear all, I would like to create a custom logger which allows logging commands in stream-style, but at the same time the output goes to some file or to the screen (cout) or to both. The code below...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.