Rsyslog exclude $programname from syslog
I get duplication on a remote rsyslog server:
Even though I've configured a catch for clamav logs from mail servers - I still get the logs appearing in syslog
# Configuration for Mail ClamAV logs in rsyslog.d
if ($fromhost contains "mail") and ($programname contains "clam") then {
action(type="omfile" file="/var/log/mail-clam.log")
}
mail-clam.log:
Jan 3 11:32:07 mail2 freshclam[265]: Received signal: wake up
Jan 3 11:32:07 mail2 freshclam[265]: ClamAV update process started at Thu Jan 3 11:32:07 2019
Jan 3 11:32:07 mail2 freshclam[265]: main.cld is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Jan 3 11:32:07 mail2 freshclam[265]: daily.cld is up to date (version: 25264, sigs: 2197013, f-level: 63, builder: raynman)
Jan 3 11:32:07 mail2 freshclam[265]: bytecode.cld is up to date (version: 328, sigs: 94, f-level: 63, builder: neo)
syslog:
Jan 3 11:32:07 mail2 freshclam[265]: Received signal: wake up
Jan 3 11:32:07 mail2 freshclam[265]: ClamAV update process started at Thu Jan 3 11:32:07 2019
Jan 3 11:32:07 mail2 freshclam[265]: main.cld is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Jan 3 11:32:07 mail2 freshclam[265]: daily.cld is up to date (version: 25264, sigs: 2197013, f-level: 63, builder: raynman)
Jan 3 11:32:07 mail2 freshclam[265]: bytecode.cld is up to date (version: 328, sigs: 94, f-level: 63, builder: neo)
I've got the following line exluding logs in rsyslog.conf:
*.*;auth,authpriv,mail.none -/var/log/syslog
I'm not sure how to exlude $programname
from syslog? What would be the correct way to approach this?
*.*;auth,authpriv,mail.none,if ($programname contains "clam") then {} -/var/log/syslog
Or can reference the if statement somehow?
debian rsyslog
add a comment |
I get duplication on a remote rsyslog server:
Even though I've configured a catch for clamav logs from mail servers - I still get the logs appearing in syslog
# Configuration for Mail ClamAV logs in rsyslog.d
if ($fromhost contains "mail") and ($programname contains "clam") then {
action(type="omfile" file="/var/log/mail-clam.log")
}
mail-clam.log:
Jan 3 11:32:07 mail2 freshclam[265]: Received signal: wake up
Jan 3 11:32:07 mail2 freshclam[265]: ClamAV update process started at Thu Jan 3 11:32:07 2019
Jan 3 11:32:07 mail2 freshclam[265]: main.cld is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Jan 3 11:32:07 mail2 freshclam[265]: daily.cld is up to date (version: 25264, sigs: 2197013, f-level: 63, builder: raynman)
Jan 3 11:32:07 mail2 freshclam[265]: bytecode.cld is up to date (version: 328, sigs: 94, f-level: 63, builder: neo)
syslog:
Jan 3 11:32:07 mail2 freshclam[265]: Received signal: wake up
Jan 3 11:32:07 mail2 freshclam[265]: ClamAV update process started at Thu Jan 3 11:32:07 2019
Jan 3 11:32:07 mail2 freshclam[265]: main.cld is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Jan 3 11:32:07 mail2 freshclam[265]: daily.cld is up to date (version: 25264, sigs: 2197013, f-level: 63, builder: raynman)
Jan 3 11:32:07 mail2 freshclam[265]: bytecode.cld is up to date (version: 328, sigs: 94, f-level: 63, builder: neo)
I've got the following line exluding logs in rsyslog.conf:
*.*;auth,authpriv,mail.none -/var/log/syslog
I'm not sure how to exlude $programname
from syslog? What would be the correct way to approach this?
*.*;auth,authpriv,mail.none,if ($programname contains "clam") then {} -/var/log/syslog
Or can reference the if statement somehow?
debian rsyslog
add a comment |
I get duplication on a remote rsyslog server:
Even though I've configured a catch for clamav logs from mail servers - I still get the logs appearing in syslog
# Configuration for Mail ClamAV logs in rsyslog.d
if ($fromhost contains "mail") and ($programname contains "clam") then {
action(type="omfile" file="/var/log/mail-clam.log")
}
mail-clam.log:
Jan 3 11:32:07 mail2 freshclam[265]: Received signal: wake up
Jan 3 11:32:07 mail2 freshclam[265]: ClamAV update process started at Thu Jan 3 11:32:07 2019
Jan 3 11:32:07 mail2 freshclam[265]: main.cld is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Jan 3 11:32:07 mail2 freshclam[265]: daily.cld is up to date (version: 25264, sigs: 2197013, f-level: 63, builder: raynman)
Jan 3 11:32:07 mail2 freshclam[265]: bytecode.cld is up to date (version: 328, sigs: 94, f-level: 63, builder: neo)
syslog:
Jan 3 11:32:07 mail2 freshclam[265]: Received signal: wake up
Jan 3 11:32:07 mail2 freshclam[265]: ClamAV update process started at Thu Jan 3 11:32:07 2019
Jan 3 11:32:07 mail2 freshclam[265]: main.cld is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Jan 3 11:32:07 mail2 freshclam[265]: daily.cld is up to date (version: 25264, sigs: 2197013, f-level: 63, builder: raynman)
Jan 3 11:32:07 mail2 freshclam[265]: bytecode.cld is up to date (version: 328, sigs: 94, f-level: 63, builder: neo)
I've got the following line exluding logs in rsyslog.conf:
*.*;auth,authpriv,mail.none -/var/log/syslog
I'm not sure how to exlude $programname
from syslog? What would be the correct way to approach this?
*.*;auth,authpriv,mail.none,if ($programname contains "clam") then {} -/var/log/syslog
Or can reference the if statement somehow?
debian rsyslog
I get duplication on a remote rsyslog server:
Even though I've configured a catch for clamav logs from mail servers - I still get the logs appearing in syslog
# Configuration for Mail ClamAV logs in rsyslog.d
if ($fromhost contains "mail") and ($programname contains "clam") then {
action(type="omfile" file="/var/log/mail-clam.log")
}
mail-clam.log:
Jan 3 11:32:07 mail2 freshclam[265]: Received signal: wake up
Jan 3 11:32:07 mail2 freshclam[265]: ClamAV update process started at Thu Jan 3 11:32:07 2019
Jan 3 11:32:07 mail2 freshclam[265]: main.cld is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Jan 3 11:32:07 mail2 freshclam[265]: daily.cld is up to date (version: 25264, sigs: 2197013, f-level: 63, builder: raynman)
Jan 3 11:32:07 mail2 freshclam[265]: bytecode.cld is up to date (version: 328, sigs: 94, f-level: 63, builder: neo)
syslog:
Jan 3 11:32:07 mail2 freshclam[265]: Received signal: wake up
Jan 3 11:32:07 mail2 freshclam[265]: ClamAV update process started at Thu Jan 3 11:32:07 2019
Jan 3 11:32:07 mail2 freshclam[265]: main.cld is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Jan 3 11:32:07 mail2 freshclam[265]: daily.cld is up to date (version: 25264, sigs: 2197013, f-level: 63, builder: raynman)
Jan 3 11:32:07 mail2 freshclam[265]: bytecode.cld is up to date (version: 328, sigs: 94, f-level: 63, builder: neo)
I've got the following line exluding logs in rsyslog.conf:
*.*;auth,authpriv,mail.none -/var/log/syslog
I'm not sure how to exlude $programname
from syslog? What would be the correct way to approach this?
*.*;auth,authpriv,mail.none,if ($programname contains "clam") then {} -/var/log/syslog
Or can reference the if statement somehow?
debian rsyslog
debian rsyslog
edited Jan 3 at 12:16
Jeff Schaller
39.3k1054125
39.3k1054125
asked Jan 3 at 12:01
itChiitChi
135
135
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The rules in the rsyslog
configuration file are evaluated from top to bottom. So, you can achieve selective logging by simply dropping the log message after the necessary processing. The 'stop' action is used to discard the log message.
In your case, modify your rsyslog.conf file to this:
if ($fromhost contains "mail") and ($programname contains "clam") then {
action(type="omfile" file="/var/log/mail-clam.log")
stop
}
...
*.*;auth,authpriv,mail.none -/var/log/syslog
With this configuration, all messages that match the expression are logged to /var/log/mail-clam.log and then discarded. This will prevent these messages from being processed further, and therefore being logged to /var/log/syslog.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f492222%2frsyslog-exclude-programname-from-syslog%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The rules in the rsyslog
configuration file are evaluated from top to bottom. So, you can achieve selective logging by simply dropping the log message after the necessary processing. The 'stop' action is used to discard the log message.
In your case, modify your rsyslog.conf file to this:
if ($fromhost contains "mail") and ($programname contains "clam") then {
action(type="omfile" file="/var/log/mail-clam.log")
stop
}
...
*.*;auth,authpriv,mail.none -/var/log/syslog
With this configuration, all messages that match the expression are logged to /var/log/mail-clam.log and then discarded. This will prevent these messages from being processed further, and therefore being logged to /var/log/syslog.
add a comment |
The rules in the rsyslog
configuration file are evaluated from top to bottom. So, you can achieve selective logging by simply dropping the log message after the necessary processing. The 'stop' action is used to discard the log message.
In your case, modify your rsyslog.conf file to this:
if ($fromhost contains "mail") and ($programname contains "clam") then {
action(type="omfile" file="/var/log/mail-clam.log")
stop
}
...
*.*;auth,authpriv,mail.none -/var/log/syslog
With this configuration, all messages that match the expression are logged to /var/log/mail-clam.log and then discarded. This will prevent these messages from being processed further, and therefore being logged to /var/log/syslog.
add a comment |
The rules in the rsyslog
configuration file are evaluated from top to bottom. So, you can achieve selective logging by simply dropping the log message after the necessary processing. The 'stop' action is used to discard the log message.
In your case, modify your rsyslog.conf file to this:
if ($fromhost contains "mail") and ($programname contains "clam") then {
action(type="omfile" file="/var/log/mail-clam.log")
stop
}
...
*.*;auth,authpriv,mail.none -/var/log/syslog
With this configuration, all messages that match the expression are logged to /var/log/mail-clam.log and then discarded. This will prevent these messages from being processed further, and therefore being logged to /var/log/syslog.
The rules in the rsyslog
configuration file are evaluated from top to bottom. So, you can achieve selective logging by simply dropping the log message after the necessary processing. The 'stop' action is used to discard the log message.
In your case, modify your rsyslog.conf file to this:
if ($fromhost contains "mail") and ($programname contains "clam") then {
action(type="omfile" file="/var/log/mail-clam.log")
stop
}
...
*.*;auth,authpriv,mail.none -/var/log/syslog
With this configuration, all messages that match the expression are logged to /var/log/mail-clam.log and then discarded. This will prevent these messages from being processed further, and therefore being logged to /var/log/syslog.
answered Jan 3 at 15:13
HaxielHaxiel
1,562410
1,562410
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f492222%2frsyslog-exclude-programname-from-syslog%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown