[RndTbl] PHP undefined vars / array indices

Gilbert E. Detillieux gedetil at cs.umanitoba.ca
Mon Jan 24 10:30:26 CST 2022


On 2022-01-22 1:58 a.m., Trevor Cordes wrote:
> On 2022-01-19 Gilbert E. Detillieux wrote:
>> I'd hold off on making/maintaining your own fork until such a time
>> the PHP brain-trust actually raises things from a warning to an
>> error.  In the meantime, if you're logging using rsyslog, it would be
>> fairly easy to add a one-line filter rule to eliminate the
>> needlessly-noisy warning messages.  No more full logs, and no more
>> actual serious warnings getting lost like a needle in the haystack!
...
> As for your log-filtering idea: it may be the easiest way out for now.
> However, PHP by default currently logs straight to file.  I'm sure
> there's a syslog option I'll have to explore.  I guess it'll add some
> overhead, but it shouldn't be too much.  I didn't know (r)syslog had a
> filtering option beyond the level-filtering!  So does it allow string
> search or regex or something?  Have you used this in the past?  A quick
> example?

It's been a while since I looked into rsyslog filtering (which isn't 
found in the original syslogd), so I'd recommend you RTFM...  But here's 
an example I did set up some time ago to suppress messages from an 
overly-chatty Avahi daemon...

/etc/rsyslog.d/avahi.conf:

# Not interested in this noise from avahi...
if $programname == 'avahi-daemon' and $msg contains 'Invalid response 
packet from host' then ~
if $programname == 'avahi-daemon' and $msg contains 'with invalid source 
port' then ~
if $programname == 'avahi-daemon' and $msg contains 'Packet too short or 
invalid' then ~
if $programname == 'avahi-daemon' and $msg contains 'Invalid legacy 
unicast query packet' then ~

> Thanks for the input!

You're welcome!

Gilbert

-- 
Gilbert E. Detillieux        E-mail:  <gedetil at cs.umanitoba.ca>
Dept. of Computer Science    Web:     http://cs.umanitoba.ca/~gedetil/
University of Manitoba
Winnipeg MB CANADA  R3T 2N2
For best service, contact <cstech at cs.umanitoba.ca>.


More information about the Roundtable mailing list