🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
11 messages
11 total messages Started by Bruce Esquibel Wed, 19 Nov 2008 14:00
cnfsstat not writing to syslog
#79693
Author: Bruce Esquibel
Date: Wed, 19 Nov 2008 14:00
30 lines
1883 bytes
Figured I toss this question out, sort of gave it the old college try this
morning but am stumped.

We're setting up a new box using Solaris 10 (x86 current u6 release) with
perl 5.8.4, inn 2.4.5 and using cnfs for the storage.

Everything seems to be working ok so far except for the logging with
cnfsstat. It's running in the background as normal (cnfsstat -s -l -P) but
it's just not writing to the news.notice file via syslog. There are just no
entries, nothing.

Running it manually is fine, prints to console the correct info. On the old
server, doing cnfsstat -s from the command line dumps the output into
news.notice.

Doing that on the new box, does not.

I tried the usual bag of starts and restarts with innd and syslog, even
added in news.debug to syslog.conf and it too receives nothing from
cnfsstats.

Everything else does work, news.notice gets the logs from innd, innfeed,
and nnrpd, but just not a single entry from cnfsstats.

Anyone have a suggestion?

-bruce
bje@ripco.com
Re: cnfsstat not writing to syslog
#79694
Author: Julien ÉLIE
Date: Wed, 19 Nov 2008 15:08
57 lines
3205 bytes
Hi Bruce,

> We're setting up a new box using Solaris 10 (x86 current u6 release) with
> perl 5.8.4, inn 2.4.5 and using cnfs for the storage.
>
> Running it manually is fine, prints to console the correct info. On the old
> server, doing cnfsstat -s from the command line dumps the output into
> news.notice.
>
> Doing that on the new box, does not.

The code is there in <pathbin>/cnfsstat:

if ($opt_s) {
    $use_syslog = 0;
    ## Comment out this eval line if you don't want to try to syslog
    eval { require Sys::Syslog; import Sys::Syslog; $use_syslog = 1 };
    if ($use_syslog) {
        if (defined &Sys::Syslog::setlogsock && $] >= 5.00403) {
        # we really need a common module to work all this junk out
            if ($OSNAME eq "dec_osf") {
                sub Sys::Syslog::_PATH_LOG { "/dev/log" }
            }
            Sys::Syslog::setlogsock('unix')
                if $OSNAME =~ /linux|freebsd|dec_osf|darwin/;
        }
        openlog ('cnfsstat', 'pid', $inn::syslog_facility);
    } else {
        print STDERR "Syslog is not available.  -s option is ignored.\n";
    }
}


Maybe you could try to change this code to:

my $use_syslog = 0;
if ($opt_s) {
    eval { require Sys::Syslog; import Sys::Syslog; $use_syslog = 1; };
    if ($use_syslog) {
        eval "sub Sys::Syslog::_PATH_LOG { '/dev/log' }" if $^O eq 'dec_osf';
        Sys::Syslog::setlogsock('unix') if $^O =~ /linux|dec_osf|freebsd|darwin/;
        openlog('cnfsstat', 'pid', $inn::syslog_facility);
    } else {
        print STDERR "Syslog is not available.  -s option is ignored.\n";
    }
}


Please tell me if it is better.

-- 
Julien ÉLIE

« A man inserted an 'ad' in the classifieds: "Wife wanted".
  Next day he received a hundred letters.  They all said
  the same thing:  "You can have mine." » 
Re: cnfsstat not writing to syslog
#79695
Author: Bruce Esquibel
Date: Wed, 19 Nov 2008 18:50
45 lines
2560 bytes
Julien ?LIE <iulius@nom-de-mon-site.com.invalid> wrote:

> Maybe you could try to change this code to:
{snip}
> Please tell me if it is better.


No, it didn't help at all but before you start racking your brains on the
next move to make, I kind of have a feeling it's something with the shipped
syslogd on Solaris 10 x86.

I only know enough perl to make life miserable for other people but am
pretty sure I hacked down that segment of code in cnfsstat so it forced
syslog and no checks for the other OSNAME, no if's or evals.

Still didn't work.

Even tried to use the older perl 5.6.1 to try to rule out a Syslog.pm
problem, no dice either.

Over the summer I ran into something similar, I want to say freeradius or
openradius, whatever it was you couldn't get it to write to syslog for
anything (on S10 x86). Hard files, no problem. Later on we needed to set up
syslog-ng anyway to get the logs over to a common syslog server via ssl and
as soon as we replaced the sun syslogd, the radius program was working fine
with syslog.

So rather than waste everyones time, I'll get the syslog-ng built soon and
see what happens.

Like I said before, innd, nnrpd and innfeed aren't having problems, but i
suspect some of the other programs like controlchan and send-uucp which use
this:

 openlog ('xxxxxxxx', 'pid', $inn::syslog_facility);

within them aren't working either with syslog, but not sure. Our old box is
running Solaris 9 and just not having this problem. 

Will get back with the results for future notation.

-bruce
bje@ripco.com
 
Re: cnfsstat not writing to syslog
#79696
Author: Bruce Esquibel
Date: Wed, 19 Nov 2008 22:31
29 lines
1913 bytes
Bruce Esquibel <bje@e4500.ripco.com> wrote:

> So rather than waste everyones time, I'll get the syslog-ng built soon and
> see what happens.


Ok, back.

Well I dropped in the syslog-ng, turned off the Solaris syslogd and as I
figured, cnfsstat has no problem writing to syslog now.

But, seeing the entry for cnfsstat now, I'm wondering if it is the Solaris
syslog to blame, here are two entries, one for innd, one for cnfsstat...

Nov 19 16:27:56 s_local@remote5bge0 innd: [ID 193570 news.warning] ME
HISstats 0 hitpos 0 hitneg 0 missed 1046 dne

Nov 19 16:28:01 s_local@remote5bge0 <61>cnfsstat[544]: Class CHIAREA for
groups matching "rci.*,chi.*" Buffer ONE, len: 979.00  Mbytes, used: 0.59
Mbytes ( 0.1%)   0 cycles


Any clues what that <61> is in front of cnfsstat is from?

I wildcarded the syslogs into one file and so far cnfsstat is the only one
that has that <??> in the entry.

-bruce
bje@ripco.com
Re: cnfsstat not writing to syslog
#79703
Author: Bruce Esquibel
Date: Thu, 20 Nov 2008 14:26
25 lines
1948 bytes
Bruce Esquibel <bje@e4500.ripco.com> wrote:

> Any clues what that <61> is in front of cnfsstat is from?

> I wildcarded the syslogs into one file and so far cnfsstat is the only one
> that has that <??> in the entry.

Just one more follow up,

I noticed this morning what the problem seems to be is cnfsstat is just
writing to syslog but without the facility and level.

In other words, the entries from innd (and innfeed, nnrpd) are all using the
news.notice, news.info and news.warning syslog facilities/levels. The
cnfsstat is just writing to syslog like "mark" or I guess "logger" on some
systems.

I'm guessing from the start of cnfsstat where it reads innshellvars.pl is
where the syslog data is being passed along to it ($syslog_facility =
lc("LOG_NEWS");) but can't really say where it's screwing up.

But I guess it's sort of an explanation why syslogd is ignoring it.

-bruce
bje@ripco.com
Re: cnfsstat not writing to syslog
#79704
Author: Julien ÉLIE
Date: Thu, 20 Nov 2008 14:53
27 lines
2272 bytes
Hi Bruce,

> I noticed this morning what the problem seems to be is cnfsstat is just
> writing to syslog but without the facility and level.
>
> I'm guessing from the start of cnfsstat where it reads innshellvars.pl is
> where the syslog data is being passed along to it ($syslog_facility =
> lc("LOG_NEWS");) but can't really say where it's screwing up.

Then:
    $syslog_facility = "news";
("LOG_" is removed by innshellvars.pl.)

There is only one call in cnfsstat:

syslog ('notice', '%s Buffer %s, len: %.2f  Mbytes, used: %.2f Mbytes (%4.1f%%) %3d cycles',
                $logline, $name, $len / (1024 * 1024),
                Math::BigFloat->new ($free) / (1024 * 1024),
                100 * Math::BigFloat->new ($free) / $len, $cyclenum);

The level is "notice".

-- 
Julien ÉLIE

« César, c'est un Jules tout de même ! » (Astérix) 
Re: cnfsstat not writing to syslog
#79706
Author: Julien ÉLIE
Date: Thu, 20 Nov 2008 15:03
39 lines
2804 bytes
Hi Bruce,

> But, seeing the entry for cnfsstat now, I'm wondering if it is the Solaris
> syslog to blame, here are two entries, one for innd, one for cnfsstat...

http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6503341

Sys::Syslog is broken in Solaris 10
    While attempting to use the Sys::Syslog module that ships with the default
    Solaris perl distribution, I noticed that I couldn't log messages unless syslog
    was configured to listed on a UDP port.


Is it what is happening?



By the way, what is the value of $OSNAME ($^O) in Solaris?
Maybe
    Sys::Syslog::setlogsock('unix');
should be removed.

I see that note in <http://perldoc.perl.org/Sys/Syslog.html>:

    Now that the "native" mechanism is supported by Sys::Syslog and selected by default,
    the use of the setlogsock() function is discouraged because other mechanisms are
    less portable across operating systems. Authors of modules and programs that use
    this function, especially its cargo-cult form setlogsock("unix") , are advised
    to remove any occurence of it unless they specifically want to use a given mechanism
    (like TCP or UDP to connect to a remote host).


Solaris seems to prefer "stream".  But setlogsock may be removed.

-- 
Julien ÉLIE

« César, c'est un Jules tout de même ! » (Astérix) 
Re: cnfsstat not writing to syslog
#79712
Author: Russ Allbery
Date: Thu, 20 Nov 2008 16:29
28 lines
2265 bytes
Bruce Esquibel <bje@e4500.ripco.com> writes:

> Just one more follow up,
>
> I noticed this morning what the problem seems to be is cnfsstat is just
> writing to syslog but without the facility and level.

I suspect that the basic problem that you're running into here is the
long-standing problem that Sys::Syslog tries to be too smart for its own
good.  For reasons that I don't really understand, the version of
Sys::Syslog that comes with Perl by default tries to implement syslog in
pure Perl by opening various devices or sockets and writing to them, and
sometimes getting it wrong.

As of Sys::Syslog 0.15, you can disable this and force it to just call the
libc syslog() function by calling:

    setlogsock('native');

before using Sys::Syslog.  I suspect that INN should start doing that as
long as the version of Sys::Syslog is new enough.  Could you give that a
try and see if that fixes your problem?

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: cnfsstat not writing to syslog
#79723
Author: Bruce Esquibel
Date: Fri, 21 Nov 2008 15:13
25 lines
1821 bytes
Russ Allbery <rra@stanford.edu> wrote:

> As of Sys::Syslog 0.15, you can disable this and force it to just call the
> libc syslog() function by calling:

>     setlogsock('native');

> before using Sys::Syslog.  I suspect that INN should start doing that as
> long as the version of Sys::Syslog is new enough.  Could you give that a
> try and see if that fixes your problem?

Yeah, this seems to have hit the nail on the head.

Installing Sys-Syslog-0.27 and adding in

Sys::Syslog::setlogsock('native');

just before the openlog (line 70) in cnfsstat, not only fixed the lack of
the facility/level but also works just fine with the native syslogd on
Solaris.

Thanks much.

-bruce
bje@ripco.com
Re: cnfsstat not writing to syslog
#79725
Author: Julien ÉLIE
Date: Fri, 21 Nov 2008 17:55
15 lines
1858 bytes
Hi Bruce,

> Installing Sys-Syslog-0.27 and adding in
>
> Sys::Syslog::setlogsock('native');

Doesn't it work also *without* that line?
The default for the log socket type is 'native'.

-- 
Julien ÉLIE

« -- Et on appelle comment ce genre de logis ?
  -- HLM... Habitations Latines Mélangées... » (Astérix) 
Re: cnfsstat not writing to syslog
#79738
Author: Julien ÉLIE
Date: Sat, 22 Nov 2008 17:55
49 lines
2774 bytes
Hi Russ,

> As of Sys::Syslog 0.15, you can disable this and force it to just call the
> libc syslog() function by calling:
>
>    setlogsock('native');
>
> before using Sys::Syslog.  I suspect that INN should start doing that as
> long as the version of Sys::Syslog is new enough.

I have put the following code in :
  backends/news2mail.in
  backends/send-uucp.in
  control/controlchan.in
  control/gpgverify.in
  control/perl-nocem.in
  frontends/cnfsstat.in
  frontends/mailpost.in

You may also want to update pgpverify and release a new version.




my $use_syslog = 0;

eval { require Sys::Syslog; import Sys::Syslog; $use_syslog = 1; };

if ($use_syslog) {
    if ($Sys::Syslog::VERSION < 0.15) {
        eval "sub Sys::Syslog::_PATH_LOG { '/dev/log' }" if $^O eq 'dec_osf';
        Sys::Syslog::setlogsock('unix') if $^O =~ /linux|dec_osf|freebsd|darwin/;
    }
    openlog('xxx', 'yyy', $INN::Config::syslog_facility);
}



Perl documentation for Sys::Syslog now writes:

The First Rule of Sys::Syslog is: You do not call setlogsock.
The Second Rule of Sys::Syslog is: You *do not* call setlogsock.

-- 
Julien ÉLIE

« Les ordinateurs dans le futur ne pèseront peut-être pas plus de
  1,5 tonne. » (Popular Mechanics, 1949) 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads