Mailing List Archive

logging of "loved" output
Hello,
I am currently using conserver with the -u option to log "unloved"
output to stdout which I then capture and parse with other programs.
Unfortunately that does not include any output that happens while a user
is attatched to the port. I need conserver to send all console output
to stdout for processessing regardless of loved or unloved. I have
played with the -U option a bit trying to get it to output to stdout
with things like -U- but that didn't work. I also discovered that -u
and -U seem to handle CRLF translations differently which is a problem
for me with -U.

I took a look into the source code and attempted to comment out the if
command that prevents the logging of loved output but that didn't seem
to help and the conserver code is a bit too convoluted for my limited
knowledge of C. Can anyone help with this?

TIA

--
Kevin
_______________________________________________
users mailing list
users@conserver.com
https://www.conserver.com/mailman/listinfo/users
Re: logging of "loved" output [ In reply to ]
On Wed, Jun 22, 2005 at 02:18:15PM -0400, Kevin Korb wrote:
> I have played with the -U option a bit trying to get it to output to
> stdout with things like -U- but that didn't work. I also discovered
> that -u and -U seem to handle CRLF translations differently which is a
> problem for me with -U.

yep, you have to give a filename to -U. '-' isn't special - it'll just
create a file called '-'.

you shouldn't see any difference between the -u and -U output as far as
cr/lf are concerned...the code is writing the same data to each. if you
end up seeing something, then it could be your tty doing translations of
that data when going to your terminal.

> I took a look into the source code and attempted to comment out the if
> command that prevents the logging of loved output but that didn't seem
> to help and the conserver code is a bit too convoluted for my limited
> knowledge of C. Can anyone help with this?

check out lines 2644 and 2656 of conserver/group.c. you'll see checks
for "pCEServing->pCLwr == (CONSCLIENT *)0". remove those and -u will
output everything.

personally, i'd use -U with a filename and get the log parsing stuff to
just read from a file (lots of tools out there do that...gnu tail can
even do cool things to help). or, even better, i'd be logging all the
console data to individual files and letting something like logsurfer do
it's magic to watch them all. then you see *all* the data, instead of
the possibly-truncated info that -u/-U give you (yes, it truncates long
lines...because of the way it wants to output individual lines per
console, it has to buffer things to prevent madness on devices that
don't produce line-oriented output).

anyway, good luck - and hopefully something here helps.

Bryan
_______________________________________________
users mailing list
users@conserver.com
https://www.conserver.com/mailman/listinfo/users
Re: logging of "loved" output [ In reply to ]
This is the patch that I tried:
--- conserver/group.c.orig 2005-06-02 17:21:10.000000000 -0400
+++ conserver/group.c 2005-06-02 17:36:36.000000000 -0400
@@ -2558,8 +2558,7 @@
* or output to unifiedlog if it's open
*/
if (unifiedlog != (CONSFILE *)0 ||
- (pCEServing->pCLwr == (CONSCLIENT *)0 &&
- pCEServing->unloved == FLAGTRUE)) {
+ pCEServing->pCLwr == (CONSCLIENT *)0) {
/* run through the console ouptut,
* add each character to the output line
* drop and reset if we have too much
@@ -2572,8 +2571,7 @@
continue;

/* unloved */
- if (pCEServing->pCLwr == (CONSCLIENT *)0 &&
- pCEServing->unloved == FLAGTRUE) {
+ if (pCEServing->pCLwr == (CONSCLIENT *)0) {
write(1, pCEServing->server, strlen(pCEServing->server));
write(1, ": ", 2);
write(1, pCEServing->acline, pCEServing->iend);


Those are different line numbers than what you said but the text looks
to be the same. The patch didn't seem to have any effect. All I get on
stdout is the login/logout messages with nothing in between.

There is a difference in how conserver treats CRLF between -u and -U
because when I run -Ufile I get 1 timestamp at the top and then never
get another one. The only time -U logs timestamps is when I am actually
logged in.

I already adapted my tools to use a file (actually a named pipe) so I am
happy with either making -u ouput everything or making -U act like -u in
terms of CRLF. I just need one of them to work the way I want it to.

--
Kevin

On Wed, 22 Jun 2005, Bryan Stansell wrote:

> Date: Wed, 22 Jun 2005 12:16:24 -0700
> From: Bryan Stansell <bryan@conserver.com>
> To: users@conserver.com
> Subject: Re: logging of "loved" output
>
> On Wed, Jun 22, 2005 at 02:18:15PM -0400, Kevin Korb wrote:
>> I have played with the -U option a bit trying to get it to output to
>> stdout with things like -U- but that didn't work. I also discovered
>> that -u and -U seem to handle CRLF translations differently which is a
>> problem for me with -U.
>
> yep, you have to give a filename to -U. '-' isn't special - it'll just
> create a file called '-'.
>
> you shouldn't see any difference between the -u and -U output as far as
> cr/lf are concerned...the code is writing the same data to each. if you
> end up seeing something, then it could be your tty doing translations of
> that data when going to your terminal.
>
>> I took a look into the source code and attempted to comment out the if
>> command that prevents the logging of loved output but that didn't seem
>> to help and the conserver code is a bit too convoluted for my limited
>> knowledge of C. Can anyone help with this?
>
> check out lines 2644 and 2656 of conserver/group.c. you'll see checks
> for "pCEServing->pCLwr == (CONSCLIENT *)0". remove those and -u will
> output everything.
>
> personally, i'd use -U with a filename and get the log parsing stuff to
> just read from a file (lots of tools out there do that...gnu tail can
> even do cool things to help). or, even better, i'd be logging all the
> console data to individual files and letting something like logsurfer do
> it's magic to watch them all. then you see *all* the data, instead of
> the possibly-truncated info that -u/-U give you (yes, it truncates long
> lines...because of the way it wants to output individual lines per
> console, it has to buffer things to prevent madness on devices that
> don't produce line-oriented output).
>
> anyway, good luck - and hopefully something here helps.
>
> Bryan
> _______________________________________________
> users mailing list
> users@conserver.com
> https://www.conserver.com/mailman/listinfo/users
>
_______________________________________________
users mailing list
users@conserver.com
https://www.conserver.com/mailman/listinfo/users
Re: logging of "loved" output [ In reply to ]
OK, I have it working the way I want it to now. The trick was to use
the logfile option in the config file instead of -u or -U. That seems
to be working perfectly for me.

Thanks for the suggestion.

--
Kevin

On Wed, 22 Jun 2005, Bryan Stansell wrote:

> Date: Wed, 22 Jun 2005 12:16:24 -0700
> From: Bryan Stansell <bryan@conserver.com>
> To: users@conserver.com
> Subject: Re: logging of "loved" output
>
> On Wed, Jun 22, 2005 at 02:18:15PM -0400, Kevin Korb wrote:
>> I have played with the -U option a bit trying to get it to output to
>> stdout with things like -U- but that didn't work. I also discovered
>> that -u and -U seem to handle CRLF translations differently which is a
>> problem for me with -U.
>
> yep, you have to give a filename to -U. '-' isn't special - it'll just
> create a file called '-'.
>
> you shouldn't see any difference between the -u and -U output as far as
> cr/lf are concerned...the code is writing the same data to each. if you
> end up seeing something, then it could be your tty doing translations of
> that data when going to your terminal.
>
>> I took a look into the source code and attempted to comment out the if
>> command that prevents the logging of loved output but that didn't seem
>> to help and the conserver code is a bit too convoluted for my limited
>> knowledge of C. Can anyone help with this?
>
> check out lines 2644 and 2656 of conserver/group.c. you'll see checks
> for "pCEServing->pCLwr == (CONSCLIENT *)0". remove those and -u will
> output everything.
>
> personally, i'd use -U with a filename and get the log parsing stuff to
> just read from a file (lots of tools out there do that...gnu tail can
> even do cool things to help). or, even better, i'd be logging all the
> console data to individual files and letting something like logsurfer do
> it's magic to watch them all. then you see *all* the data, instead of
> the possibly-truncated info that -u/-U give you (yes, it truncates long
> lines...because of the way it wants to output individual lines per
> console, it has to buffer things to prevent madness on devices that
> don't produce line-oriented output).
>
> anyway, good luck - and hopefully something here helps.
>
> Bryan
> _______________________________________________
> users mailing list
> users@conserver.com
> https://www.conserver.com/mailman/listinfo/users
>
_______________________________________________
users mailing list
users@conserver.com
https://www.conserver.com/mailman/listinfo/users
Re: logging of "loved" output [ In reply to ]
On Wed, Jun 22, 2005 at 03:37:48PM -0400, Kevin Korb wrote:
> Those are different line numbers than what you said but the text looks
> to be the same. The patch didn't seem to have any effect. All I get on
> stdout is the login/logout messages with nothing in between.

you zapped the wrong lines. you want to keep the 'unloved' stuff and
nuke the 'pCLwr' stuff.

> There is a difference in how conserver treats CRLF between -u and -U
> because when I run -Ufile I get 1 timestamp at the top and then never
> get another one. The only time -U logs timestamps is when I am actually
> logged in.

huh? as i said, conserver doesn't do anything different between the two
methods...they both output the same data.

now, interpreting things a bit differently, based on hints above, it
could be that file buffering is biting you. stuff going to the file
based on -U will, by default, be buffered to a block at a time...instead
of line based or character based. is *that* what's happening? (all
file output is that way, actually).

what confuses me is you're saying things behave differently when you're
logged in. i'm not seeing that behavior. if you could specify how to
reproduce the problem, that would be good.

your other message said the 'logfile' option helped. that just sends
stuff that would have been stdout/stderr to a file. unless you hacked
the -u code, you still wouldn't get output when users are attached.

basically, i'm thoroughly confused. i'm glad it's working for you, but
i'm hoping that if there are issues, i can get more details and fix
things.

Bryan
_______________________________________________
users mailing list
users@conserver.com
https://www.conserver.com/mailman/listinfo/users
Re: logging of "loved" output [ In reply to ]
OK, I went back to my log file from when I was testing with -U and at
first it looks like what I described however when I dig into it with a
hex editor I can see what is happening...

When I was attached I saw:
[timestamp] [port]*: data\r\n

When I was NOT attached in I saw:
[timestamp] [port]: \rdata\r\n

This difference was probably just a tcsh vs syslog thing and not related
to conserver.

The first \r was overwriting the timestamp on my display and causing it
to dissapear. The \r at the end was also getting truncated most of the
time do to the length of the lines causing the results to look even more
random.

I am going to stick with my current setup for now since using the
logfile option in the config file doesn't truncate the lines like -U and
-u did.

BTW, the I am not using conserver for the timestamping. I have
timestamp set to "" in the config file and I am piping the output
through multilog (http://cr.yp.to/daemontools/multilog.html) to get
tai64n formatted timestamps instead which is why I wanted output to
stdout before. Now I am getting that functionality by setting the
logfile to a named pipe that multilog is reading.

Not sure why the Linux consoles are putting in all those extra \r chars.

Thanks for the help.

--
Kevin

On Wed, 22 Jun 2005, Bryan Stansell wrote:

> Date: Wed, 22 Jun 2005 15:20:43 -0700
> From: Bryan Stansell <bryan@conserver.com>
> To: users@conserver.com
> Subject: Re: logging of "loved" output
>
> On Wed, Jun 22, 2005 at 03:37:48PM -0400, Kevin Korb wrote:
>> Those are different line numbers than what you said but the text looks
>> to be the same. The patch didn't seem to have any effect. All I get on
>> stdout is the login/logout messages with nothing in between.
>
> you zapped the wrong lines. you want to keep the 'unloved' stuff and
> nuke the 'pCLwr' stuff.
>
>> There is a difference in how conserver treats CRLF between -u and -U
>> because when I run -Ufile I get 1 timestamp at the top and then never
>> get another one. The only time -U logs timestamps is when I am actually
>> logged in.
>
> huh? as i said, conserver doesn't do anything different between the two
> methods...they both output the same data.
>
> now, interpreting things a bit differently, based on hints above, it
> could be that file buffering is biting you. stuff going to the file
> based on -U will, by default, be buffered to a block at a time...instead
> of line based or character based. is *that* what's happening? (all
> file output is that way, actually).
>
> what confuses me is you're saying things behave differently when you're
> logged in. i'm not seeing that behavior. if you could specify how to
> reproduce the problem, that would be good.
>
> your other message said the 'logfile' option helped. that just sends
> stuff that would have been stdout/stderr to a file. unless you hacked
> the -u code, you still wouldn't get output when users are attached.
>
> basically, i'm thoroughly confused. i'm glad it's working for you, but
> i'm hoping that if there are issues, i can get more details and fix
> things.
>
> Bryan
> _______________________________________________
> users mailing list
> users@conserver.com
> https://www.conserver.com/mailman/listinfo/users
>
_______________________________________________
users mailing list
users@conserver.com
https://www.conserver.com/mailman/listinfo/users