Re: Selective application of keep-hostname()?

"Peter Kokai (pkokai)" <[email protected]>
Newsgroups gmane.comp.syslog-ng
Message-ID <CO1PR19MB49036247711CA60C0D31E79EF8669@CO1PR19MB4903.namprd19.prod.outlook.com>
Hello,

The keep-hostname cannot be applied based on message content. You could do exactly as you stated with multiple sources,
or as an alternative use a rewrite to set hostname conditionally.
First set keep-hostname to yes, and add a conditional *set* to use $HOST_FROM value.

        rewrite {
                set("$HOST_FROM" value("HOST") condition("${SOURCEIP}" eq "127.0.0.1"));
        };

--
Kokan

________________________________________
From: syslog-ng <[email protected]> on behalf of Steve Bernacki <[email protected]>
Sent: 29 November 2021 21:41
To: [email protected]
Subject: [syslog-ng] Selective application of keep-hostname()?

CAUTION: This email originated from outside of the organization. Do not follow guidance, click links, or open attachments unless you recognize the sender and know the content is safe.


I have a use case where I need to selectively apply keep-hostname(yes)
to messages from certain source IPs, while defaulting to
keep-hostname(no) for the rest of my sources. I know I can apply this
option on a per-source basis, but in this case I want to be able to
selectively apply this option based on the source IP of the message. I'm
trying to avoid having to set up an alternate port if I can.

Thanks
Steve

______________________________________________________________________________
Member info: https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.balabit.hu%2Fmailman%2Flistinfo%2Fsyslog-ng&amp;data=04%7C01%7Cpeter.kokai%40oneidentity.com%7C38fe75a710404f01f4cc08d9b378a32c%7C91c369b51c9e439c989c1867ec606603%7C0%7C1%7C637738152997971289%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=StmreyM%2BOhehLZ3MnV5%2FuJD%2FK7Qpfqvk2Ce2LLjDBDI%3D&amp;reserved=0
Documentation: https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fsupport%2Fdocumentation%2F%3Fproduct%3Dsyslog-ng&amp;data=04%7C01%7Cpeter.kokai%40oneidentity.com%7C38fe75a710404f01f4cc08d9b378a32c%7C91c369b51c9e439c989c1867ec606603%7C0%7C1%7C637738152997971289%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=zSZPhvZP7h6ccYseeUag%2FrUDA06eOWb0a3RQhCiNrNM%3D&amp;reserved=0
FAQ: https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fwiki%2Fsyslog-ng-faq&amp;data=04%7C01%7Cpeter.kokai%40oneidentity.com%7C38fe75a710404f01f4cc08d9b378a32c%7C91c369b51c9e439c989c1867ec606603%7C0%7C1%7C637738152997971289%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=qkHvuxq5Tf9lJlhCkbeXieres4H1pKFXdPvvXsUxYQQ%3D&amp;reserved=0

______________________________________________________________________________
Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
FAQ: http://www.balabit.com/wiki/syslog-ng-faq
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.