Rsyslog alter log line before forwarding
up vote
0
down vote
favorite
being on Ubuntu 16.04.5 LTS with rsyslogd.
We have the following situation:
(1) An appliance forwards syslog to the Ubuntu host.
(2) Ubuntu Host stores those forwarded messages in a separate logfile
(3) Ubuntu Host also forwards this to a 3rd machine
Details how configuration currently looks like
(1)
In /etc/rsyslog.conf, follwing has been enabled:
# provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514")
# provides TCP syslog reception
module(load="imtcp")
input(type="imtcp" port="514")
(2)
Has been achieved by creating 30-remotehosts.conf in /etc/rsyslog.d with following content:
:fromhost-ip, isequal, "<sending_IP>" /var/log/remotesyslog/<name>.log
& ~
(3) has been achieved by way of creating 10-send_to_other_hosts.conf in /etc/rsyslog.d with following content:
:fromhost-ip, isequal, "<sending_IP>" @<destination_IP>:514
So far so good, works as expected.
However, what we would need now is to alter the logline before sending to the destination.
One example log line currently is
Dec 7 11:10:07 srvde450.rce-group.local [S=582442040] [SID=9642c9:20:3850677] 1 RTP packets lost: CID=217 [Code:0x600b] [CID:217] [Time:07-12@10:10:13]
We would neet it to be changed to the following before sending to the destination:
[S=582442040] [SID=9642c9:20:3850677] 1 RTP packets lost: CID=217 [Code:0x600b] [CID:217] [Time:07-12@10:10:13]
So remove timestamp and source.
How could that be achieved?
linux ubuntu rsyslog rsyslogd
New contributor
add a comment |
up vote
0
down vote
favorite
being on Ubuntu 16.04.5 LTS with rsyslogd.
We have the following situation:
(1) An appliance forwards syslog to the Ubuntu host.
(2) Ubuntu Host stores those forwarded messages in a separate logfile
(3) Ubuntu Host also forwards this to a 3rd machine
Details how configuration currently looks like
(1)
In /etc/rsyslog.conf, follwing has been enabled:
# provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514")
# provides TCP syslog reception
module(load="imtcp")
input(type="imtcp" port="514")
(2)
Has been achieved by creating 30-remotehosts.conf in /etc/rsyslog.d with following content:
:fromhost-ip, isequal, "<sending_IP>" /var/log/remotesyslog/<name>.log
& ~
(3) has been achieved by way of creating 10-send_to_other_hosts.conf in /etc/rsyslog.d with following content:
:fromhost-ip, isequal, "<sending_IP>" @<destination_IP>:514
So far so good, works as expected.
However, what we would need now is to alter the logline before sending to the destination.
One example log line currently is
Dec 7 11:10:07 srvde450.rce-group.local [S=582442040] [SID=9642c9:20:3850677] 1 RTP packets lost: CID=217 [Code:0x600b] [CID:217] [Time:07-12@10:10:13]
We would neet it to be changed to the following before sending to the destination:
[S=582442040] [SID=9642c9:20:3850677] 1 RTP packets lost: CID=217 [Code:0x600b] [CID:217] [Time:07-12@10:10:13]
So remove timestamp and source.
How could that be achieved?
linux ubuntu rsyslog rsyslogd
New contributor
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
being on Ubuntu 16.04.5 LTS with rsyslogd.
We have the following situation:
(1) An appliance forwards syslog to the Ubuntu host.
(2) Ubuntu Host stores those forwarded messages in a separate logfile
(3) Ubuntu Host also forwards this to a 3rd machine
Details how configuration currently looks like
(1)
In /etc/rsyslog.conf, follwing has been enabled:
# provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514")
# provides TCP syslog reception
module(load="imtcp")
input(type="imtcp" port="514")
(2)
Has been achieved by creating 30-remotehosts.conf in /etc/rsyslog.d with following content:
:fromhost-ip, isequal, "<sending_IP>" /var/log/remotesyslog/<name>.log
& ~
(3) has been achieved by way of creating 10-send_to_other_hosts.conf in /etc/rsyslog.d with following content:
:fromhost-ip, isequal, "<sending_IP>" @<destination_IP>:514
So far so good, works as expected.
However, what we would need now is to alter the logline before sending to the destination.
One example log line currently is
Dec 7 11:10:07 srvde450.rce-group.local [S=582442040] [SID=9642c9:20:3850677] 1 RTP packets lost: CID=217 [Code:0x600b] [CID:217] [Time:07-12@10:10:13]
We would neet it to be changed to the following before sending to the destination:
[S=582442040] [SID=9642c9:20:3850677] 1 RTP packets lost: CID=217 [Code:0x600b] [CID:217] [Time:07-12@10:10:13]
So remove timestamp and source.
How could that be achieved?
linux ubuntu rsyslog rsyslogd
New contributor
being on Ubuntu 16.04.5 LTS with rsyslogd.
We have the following situation:
(1) An appliance forwards syslog to the Ubuntu host.
(2) Ubuntu Host stores those forwarded messages in a separate logfile
(3) Ubuntu Host also forwards this to a 3rd machine
Details how configuration currently looks like
(1)
In /etc/rsyslog.conf, follwing has been enabled:
# provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514")
# provides TCP syslog reception
module(load="imtcp")
input(type="imtcp" port="514")
(2)
Has been achieved by creating 30-remotehosts.conf in /etc/rsyslog.d with following content:
:fromhost-ip, isequal, "<sending_IP>" /var/log/remotesyslog/<name>.log
& ~
(3) has been achieved by way of creating 10-send_to_other_hosts.conf in /etc/rsyslog.d with following content:
:fromhost-ip, isequal, "<sending_IP>" @<destination_IP>:514
So far so good, works as expected.
However, what we would need now is to alter the logline before sending to the destination.
One example log line currently is
Dec 7 11:10:07 srvde450.rce-group.local [S=582442040] [SID=9642c9:20:3850677] 1 RTP packets lost: CID=217 [Code:0x600b] [CID:217] [Time:07-12@10:10:13]
We would neet it to be changed to the following before sending to the destination:
[S=582442040] [SID=9642c9:20:3850677] 1 RTP packets lost: CID=217 [Code:0x600b] [CID:217] [Time:07-12@10:10:13]
So remove timestamp and source.
How could that be achieved?
linux ubuntu rsyslog rsyslogd
linux ubuntu rsyslog rsyslogd
New contributor
New contributor
edited 2 days ago
New contributor
asked 2 days ago
bezibaerchen
11
11
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
You should be able to do this by specifying a template for the data which would just have the msg
field. Note, however, that the remote server may not parse the resulting non-standard line, so it may not be able to handle it using a default setup.
Create a template with, for example,
$template myedit,"%msg%n"
and use it in your filter line:
:fromhost-ip, isequal, "<sending_IP>" @<destination_IP>:514;myedit
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
You should be able to do this by specifying a template for the data which would just have the msg
field. Note, however, that the remote server may not parse the resulting non-standard line, so it may not be able to handle it using a default setup.
Create a template with, for example,
$template myedit,"%msg%n"
and use it in your filter line:
:fromhost-ip, isequal, "<sending_IP>" @<destination_IP>:514;myedit
add a comment |
up vote
1
down vote
You should be able to do this by specifying a template for the data which would just have the msg
field. Note, however, that the remote server may not parse the resulting non-standard line, so it may not be able to handle it using a default setup.
Create a template with, for example,
$template myedit,"%msg%n"
and use it in your filter line:
:fromhost-ip, isequal, "<sending_IP>" @<destination_IP>:514;myedit
add a comment |
up vote
1
down vote
up vote
1
down vote
You should be able to do this by specifying a template for the data which would just have the msg
field. Note, however, that the remote server may not parse the resulting non-standard line, so it may not be able to handle it using a default setup.
Create a template with, for example,
$template myedit,"%msg%n"
and use it in your filter line:
:fromhost-ip, isequal, "<sending_IP>" @<destination_IP>:514;myedit
You should be able to do this by specifying a template for the data which would just have the msg
field. Note, however, that the remote server may not parse the resulting non-standard line, so it may not be able to handle it using a default setup.
Create a template with, for example,
$template myedit,"%msg%n"
and use it in your filter line:
:fromhost-ip, isequal, "<sending_IP>" @<destination_IP>:514;myedit
answered 2 days ago
meuh
31.2k11754
31.2k11754
add a comment |
add a comment |
bezibaerchen is a new contributor. Be nice, and check out our Code of Conduct.
bezibaerchen is a new contributor. Be nice, and check out our Code of Conduct.
bezibaerchen is a new contributor. Be nice, and check out our Code of Conduct.
bezibaerchen is a new contributor. Be nice, and check out our Code of Conduct.
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f486550%2frsyslog-alter-log-line-before-forwarding%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