Re: Easy way to add /etc/motd to Logwatch report?
"Threet, Robert A" <[email protected]> Wed, 19 May 2021 19:07:00 +0000
| Newsgroups | gmane.comp.log.logwatch.devel |
|---|---|
| Message-ID | <DM5PR05MB3516A28502560A0CFDD1B086E72B9@DM5PR05MB3516.namprd05.prod.outlook.com> |
--===============0605981214733509462==
Content-Language: en-US
Content-Type: multipart/alternative;
boundary="_000_DM5PR05MB3516A28502560A0CFDD1B086E72B9DM5PR05MB3516namp_"
--_000_DM5PR05MB3516A28502560A0CFDD1B086E72B9DM5PR05MB3516namp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Ok, first time to attempt this. What I did:
Copied zz-runtime to zz-motd
s/uptime/motd/g
s/Uptime/MOTD/g
Removed line:
my $show_motd =3D $ENV{'show_motd'} || 0;
Modified line:
if (($ENV{'PRINTING'} eq "y" ) && $show_motd && $motd) {
to
if (($ENV{'PRINTING'} eq "y" ) && $motd) {
Result (which doesn't work despite config set to Services =3D ALL):
bash-5.1# pwd
/usr/share/logwatch/scripts/services
bash-5.1# cat zz-motd
########################################################
# Please file all bug reports, patches, and feature
# requests under:
# https://sourceforge.net/p/logwatch/_list/tickets
# Help requests and discusion can be filed under:
# https://sourceforge.net/p/logwatch/discussion/
########################################################
#######################################################
## Copyright (c) 2008 Kirk Bauer
## Covered under the included MIT/X-Consortium License:
## http://www.opensource.org/licenses/mit-license.php
## All modifications and contributions by other persons to
## this script are assumed to have been donated to the
## Logwatch project and thus assume the above copyright
## and licensing terms. If you want to make contributions
## under your own copyright or a different license this
## must be explicitly stated in the contribution an the
## Logwatch project reserves the right to not accept such
## contributions. If you have made significant
## contributions to this script and want to claim
## copyright please contact [email protected]
#########################################################
my $motd=3D`cat /etc/motd`;
if (($ENV{'PRINTING'} eq "y" ) && $motd) {
print "\nMOTD: $motd\n";
}
# vi: shiftwidth=3D3 tabstop=3D3 syntax=3Dperl et
# Local Variables:
# mode: perl
# perl-indent-level: 3
# indent-tabs-mode: nil
# End:
Robert Threet
Systems Manager
Information Technology
(812) 465-1082
Confidentiality Statement: This email message, including any attachments, i=
s for the sole use of the intended recipient(s) and may contain confidentia=
l and privileged information.
________________________________
From: Mike Tremaine <mgt-DY+kYuDXiUrz68fS/h/[email protected]>
Sent: Tuesday, May 18, 2021 8:07 PM
To: Threet, Robert A <[email protected]>
Cc: [email protected] <[email protected]=
net>
Subject: Re: [Logwatch-devel] Easy way to add /etc/motd to Logwatch report?
*** This message was sent from a non-USI address. Please exercise caution w=
hen responding, clicking on links or opening attachments. ***
Take a look at one of the simpler scripts like zz-runtime [ by default in =
/usr/share/logwatch/scripts/services ]
You could roll your own service by copying that and then added the configur=
ation or you could just as easily just hack that one to add your output.
-Mike
On May 18, 2021, at 1:19 PM, Threet, Robert A <[email protected]<mailto=
:[email protected]>> wrote:
I have some information going into /etc/motd that refreshes 3x a week and i=
s unique to the server. I would like that added to my logwatch report.
Seems like it'd be easy?
Robert Threet
Confidentiality Statement: This email message, including any attachments, i=
s for the sole use of the intended recipient(s) and may contain confidentia=
l and privileged information.
_______________________________________________
Logwatch-devel mailing list
[email protected]<mailto:[email protected]=
e.net>
https://lists.sourceforge.net/lists/listinfo/logwatch-devel<https://nam11.s=
afelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Flists.sourceforge.net%=
2Flists%2Flistinfo%2Flogwatch-devel&data=3D04%7C01%7Crobert.threet%40usi.ed=
u%7C5817424131444e2d6bd508d91a627f42%7Cae1d882c786b492c90953d81d0a2f615%7C0=
%7C0%7C637569832613431718%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQI=
joiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3DAo8xRErtkGXc95oiPU=
2pjsTtYyk3%2B5wOgbsZMokHK5g%3D&reserved=3D0>
--_000_DM5PR05MB3516A28502560A0CFDD1B086E72B9DM5PR05MB3516namp_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Ok, first time to attempt this. What I did:</div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Copied zz-runtime to zz-motd</div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
s/uptime/motd/g</div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
s/Uptime/MOTD/g</div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Removed line: </div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style=3D"color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); d=
isplay: inline !important;">my $show_motd =3D $ENV{'show_motd'} || 0;</span=
><br>
</div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style=3D"color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); d=
isplay: inline !important;"><br>
</span></div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style=3D"color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); d=
isplay: inline !important;">Modified line:</span></div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style=3D"color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); d=
isplay: inline !important;"><span style=3D"color: rgb(0, 0, 0); background-=
color: rgb(255, 255, 255); display: inline !important;">if (($ENV{'PRINTING=
'} eq "y" ) && $show_motd && $motd)
{</span><br>
</span></div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style=3D"color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); d=
isplay: inline !important;"><span style=3D"color: rgb(0, 0, 0); background-=
color: rgb(255, 255, 255); display: inline !important;">to </span></sp=
an></div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style=3D"color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); d=
isplay: inline !important;"><span style=3D"color: rgb(0, 0, 0); background-=
color: rgb(255, 255, 255); display: inline !important;"><span style=3D"colo=
r: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !imp=
ortant;">if
(($ENV{'PRINTING'} eq "y" ) && $motd) {</span><br>
</span></span></div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style=3D"color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); d=
isplay: inline !important;"><span style=3D"color: rgb(0, 0, 0); background-=
color: rgb(255, 255, 255); display: inline !important;"><span style=3D"colo=
r: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !imp=
ortant;"><br>
</span></span></span></div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Result (which doesn't work despite config set to Services =3D ALL):</div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
bash-5.1# pwd
<div>/usr/share/logwatch/scripts/services</div>
<div>bash-5.1# cat zz-motd</div>
<div><br>
</div>
<div>########################################################</div>
<div># Please file all bug reports, patches, and feature</div>
<div># requests under:</div>
<div># https://sourceforge.net/p/logwatch/_list/tickets=
</div>
<div># Help requests and discusion can be filed under:</div>
<div># https://sourceforge.net/p/logwatch/discussion/</=
div>
<div>########################################################</div>
<div><br>
</div>
<div>#######################################################</div>
<div>## Copyright (c) 2008 Kirk Bauer</div>
<div>## Covered under the included MIT/X-Consortium License:</div>
<div>## http://www.opensource.org/licenses/mit-license.php</di=
v>
<div>## All modifications and contributions by other persons to</div>
<div>## this script are assumed to have been donated to the</div>
<div>## Logwatch project and thus assume the above copyright</div>
<div>## and licensing terms. If you want to make contributions</div>
<div>## under your own copyright or a different license this</div>
<div>## must be explicitly stated in the contribution an the</div>
<div>## Logwatch project reserves the right to not accept such</div>
<div>## contributions. If you have made significant</div>
<div>## contributions to this script and want to claim</div>
<div>## copyright please contact [email protected]</div=
>
<div>#########################################################</div>
<div><br>
</div>
<div>my $motd=3D`cat /etc/motd`;</div>
<div>if (($ENV{'PRINTING'} eq "y" ) && $motd) {<br>
</div>
<div> print "\nMOTD: $motd\n";</div>
<div>}</div>
<div><br>
</div>
<div># vi: shiftwidth=3D3 tabstop=3D3 syntax=3Dperl et</div>
<div># Local Variables:</div>
<div># mode: perl</div>
<div># perl-indent-level: 3</div>
<div># indent-tabs-mode: nil</div>
<span># End:</span><br>
</div>
<div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id=3D"Signature">
<div>
<div name=3D"divtagdefaultwrapper" style=3D"font-family:Calibri,Arial,Helve=
tica,sans-serif; font-size:; margin:0">
<div class=3D"BodyFragment"><font size=3D"2">
<div class=3D"PlainText">Robert Threet<br>
Systems Manager<br>
Information Technology<br>
(812) 465-1082<br>
Confidentiality Statement: This email message, including any attachments, i=
s for the sole use of the intended recipient(s) and may contain confidentia=
l and privileged information.</div>
</font></div>
</div>
</div>
</div>
</div>
<div id=3D"appendonsend"></div>
<hr style=3D"display:inline-block;width:98%" tabindex=3D"-1">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" st=
yle=3D"font-size:11pt" color=3D"#000000"><b>From:</b> Mike Tremaine <mgt=
@stellarcore.net><br>
<b>Sent:</b> Tuesday, May 18, 2021 8:07 PM<br>
<b>To:</b> Threet, Robert A <[email protected]><br>
<b>Cc:</b> [email protected] <[email protected]=
urceforge.net><br>
<b>Subject:</b> Re: [Logwatch-devel] Easy way to add /etc/motd to Logwatch =
report?</font>
<div> </div>
</div>
<div class=3D"" style=3D"word-wrap:break-word; line-break:after-white-space=
"><style type=3D"text/css">
<!--
.x_usidisclaimer
{border:2px solid #002856;
background-color:#efefef;
color:#002856;
text-align:center;
padding:5px}
-->
</style>
<p class=3D"x_usidisclaimer">*** This message was sent from a non-USI addre=
ss. Please exercise caution when responding, clicking on links or opening a=
ttachments. ***
</p>
<div>Take a look at one of the simpler scripts like zz-runtime [ by d=
efault in /usr/share/logwatch/scripts/services ]
<div class=3D""><br class=3D"">
</div>
<div class=3D"">You could roll your own service by copying that and then ad=
ded the configuration or you could just as easily just hack that one to add=
your output.</div>
<div class=3D""><br class=3D"">
</div>
<div class=3D"">-Mike</div>
<div class=3D""><br class=3D"">
<div><br class=3D"">
<blockquote type=3D"cite" class=3D"">
<div class=3D"">On May 18, 2021, at 1:19 PM, Threet, Robert A <<a href=
=3D"mailto:[email protected]" class=3D"">[email protected]</a>> =
wrote:</div>
<br class=3D"x_Apple-interchange-newline">
<div class=3D"">
<div class=3D"" style=3D"font-style:normal; font-variant-caps:normal; font-=
weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; te=
xt-transform:none; white-space:normal; word-spacing:0px; text-decoration:no=
ne; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; backgro=
und-color:rgb(255,255,255)">
I have some information going into /etc/motd that refreshes 3x a week and i=
s unique to the server. I would like that added to my logwatch report=
.</div>
<div class=3D"" style=3D"font-style:normal; font-variant-caps:normal; font-=
weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; te=
xt-transform:none; white-space:normal; word-spacing:0px; text-decoration:no=
ne; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; backgro=
und-color:rgb(255,255,255)">
<br class=3D"">
</div>
<div class=3D"" style=3D"font-style:normal; font-variant-caps:normal; font-=
weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; te=
xt-transform:none; white-space:normal; word-spacing:0px; text-decoration:no=
ne; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; backgro=
und-color:rgb(255,255,255)">
Seems like it'd be easy?</div>
<div class=3D"" style=3D"font-style:normal; font-variant-caps:normal; font-=
weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; te=
xt-transform:none; white-space:normal; word-spacing:0px; text-decoration:no=
ne; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; backgro=
und-color:rgb(255,255,255)">
<br class=3D"">
</div>
<div class=3D"" style=3D"font-style:normal; font-variant-caps:normal; font-=
weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; te=
xt-transform:none; white-space:normal; word-spacing:0px; text-decoration:no=
ne; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; backgro=
und-color:rgb(255,255,255)">
<br class=3D"">
</div>
<div class=3D"" style=3D"font-family:Helvetica; font-size:12px; font-style:=
normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal=
; text-align:start; text-indent:0px; text-transform:none; white-space:norma=
l; word-spacing:0px; text-decoration:none">
<div id=3D"x_Signature" class=3D"">
<div class=3D"">
<div name=3D"x_divtagdefaultwrapper" class=3D"" style=3D"font-family:Calibr=
i,Arial,Helvetica,sans-serif; margin:0px">
<div class=3D"x_BodyFragment"><font size=3D"2" class=3D"">
<div class=3D"x_PlainText">Robert Threet<br class=3D"">
Confidentiality Statement: This email message, including any attachments, i=
s for the sole use of the intended recipient(s) and may contain confidentia=
l and privileged information.</div>
</font></div>
</div>
</div>
</div>
</div>
<span class=3D"" style=3D"font-family:Helvetica; font-size:12px; font-style=
:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:norma=
l; text-align:start; text-indent:0px; text-transform:none; white-space:norm=
al; word-spacing:0px; text-decoration:none; float:none; display:inline!impo=
rtant">_______________________________________________</span><br class=3D""=
style=3D"font-family:Helvetica; font-size:12px; font-style:normal; font-va=
riant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:st=
art; text-indent:0px; text-transform:none; white-space:normal; word-spacing=
:0px; text-decoration:none">
<span class=3D"" style=3D"font-family:Helvetica; font-size:12px; font-style=
:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:norma=
l; text-align:start; text-indent:0px; text-transform:none; white-space:norm=
al; word-spacing:0px; text-decoration:none; float:none; display:inline!impo=
rtant">Logwatch-devel
mailing list</span><br class=3D"" style=3D"font-family:Helvetica; font-siz=
e:12px; font-style:normal; font-variant-caps:normal; font-weight:normal; le=
tter-spacing:normal; text-align:start; text-indent:0px; text-transform:none=
; white-space:normal; word-spacing:0px; text-decoration:none">
<a href=3D"mailto:[email protected]" class=3D"" style=3D=
"font-family:Helvetica; font-size:12px; font-style:normal; font-variant-cap=
s:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-ali=
gn:start; text-indent:0px; text-transform:none; white-space:normal; widows:=
auto; word-spacing:0px">[email protected]</a><br class=
=3D"" style=3D"font-family:Helvetica; font-size:12px; font-style:normal; fo=
nt-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-ali=
gn:start; text-indent:0px; text-transform:none; white-space:normal; word-sp=
acing:0px; text-decoration:none">
<a href=3D"https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2=
F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Flogwatch-devel&data=3D04=
%7C01%7Crobert.threet%40usi.edu%7C5817424131444e2d6bd508d91a627f42%7Cae1d88=
2c786b492c90953d81d0a2f615%7C0%7C0%7C637569832613431718%7CUnknown%7CTWFpbGZ=
sb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1=
000&sdata=3DAo8xRErtkGXc95oiPU2pjsTtYyk3%2B5wOgbsZMokHK5g%3D&reserv=
ed=3D0" originalsrc=3D"https://lists.sourceforge.net/lists/listinfo/logwatc=
h-devel" shash=3D"zjWwqFg/wzFFYdAjkriDc9PXsELAmFHGL9SHsO3Il6ccL/PeZJEejL1nQ=
qBpvkEyVXZ9IiY3RwwuVj6Ad5xa2lEVvobs7W6sOMcUkqsZ2zxkE0eUIxLkFtBXlpSNekiTlZix=
+DfQLCGX3B/+cL/V/HQqnUQGzwtL+KwmNKi9zLM=3D" class=3D"" style=3D"font-family=
:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; fo=
nt-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; te=
xt-indent:0px; text-transform:none; white-space:normal; widows:auto; word-s=
pacing:0px">https://lists.sourceforge.net/lists/listinfo/logwatch-devel</a>=
</div>
</blockquote>
</div>
<br class=3D"">
</div>
</div>
</div>
</body>
</html>
--_000_DM5PR05MB3516A28502560A0CFDD1B086E72B9DM5PR05MB3516namp_--
--===============0605981214733509462==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============0605981214733509462==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Logwatch-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/logwatch-devel
--===============0605981214733509462==--