{"id":1877,"date":"2024-09-28T17:39:48","date_gmt":"2024-09-28T15:39:48","guid":{"rendered":"https:\/\/bergs.biz\/blog\/?p=1877"},"modified":"2024-09-28T17:42:24","modified_gmt":"2024-09-28T15:42:24","slug":"rsyslog-configuration-for-remote-logging","status":"publish","type":"post","link":"https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/","title":{"rendered":"rsyslog Configuration for remote Logging"},"content":{"rendered":"\n<p>I want all the network devices in my house to log to a central location, so that log messages can be<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>stored permanently (if I switch off an access point, normally all logs are gone), and<\/li>\n\n\n\n<li>automatically checked for interesting events.<\/li>\n<\/ul>\n\n\n\n<p>So I needed to set up my internal Ubuntu-based server to receive log messages from these devices via the <code>syslog<\/code> protocol.<\/p>\n\n\n\n<p>My requirements were:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Logs from different devices should go into a dedicated file each.<\/li>\n\n\n\n<li>Logs from the local machine should <em>not<\/em> go into any of these files, but the standard Ubuntu logging should be continued to be observed.<\/li>\n<\/ul>\n\n\n\n<p>It took me a while to figure out how the &#8220;ultimate&#8221; configuration should be, but here&#8217;s the result in case anybody else has similar requirements:<\/p>\n\n\n\n<!--more-->\n\n\n\n<pre class=\"wp-block-code\"><code># Define a template for the remote log file\ntemplate(name=\"TmplRemote\" type=\"list\") {\n    constant(value=\"\/var\/log\/remote\/\")\n    property(name=\"hostname\" SecurePath=\"replace\")\n    constant(value=\".log\")\n}\n\n# provides UDP syslog reception\nmodule(load=\"imudp\")\n\n# provides TCP syslog reception\nmodule(load=\"imtcp\")\n\nruleset(name=\"remote\"){\n    # Filter messages from remote hosts and write to the dedicated file\n    if ($fromhost-ip != '127.0.0.1') then {\n        action(type=\"omfile\" dynafile=\"TmplRemote\")\n    } else {\n        # Prevent local messages from being written to the remote log file\n        stop\n    }\n}\n\ninput(type=\"imudp\" port=\"514\" ruleset=\"remote\")\ninput(type=\"imtcp\" port=\"514\" ruleset=\"remote\")<\/code><\/pre>\n\n\n\n<p>Put the above into a file called <code><kbd>\/etc\/rsyslog.d\/99-local.conf<\/kbd><\/code>, create directory <kbd>\/var\/log\/remote\/<\/kbd>, then restart <code><kbd>rsyslog<\/kbd><\/code> as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo systemctl restart rsyslog.service<\/code><\/pre>\n\n\n\n<p>BTW, in case you wonder about the <kbd>SecurePath<\/kbd> property for the remote host name, this is a security measure.<\/p>\n\n\n\n<p>At home with your own trusted equipment this is not really required. But in &#8220;hostile&#8221; environments with untrusted traffic it could happen that somebody tries an attack by &#8220;crafting&#8221; a host name that would then be used as path name on your logging server and potentially create files that you didn&#8217;t foresee.<\/p>\n\n\n\n<p>Did this help? Then let me know, please.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I want all the network devices in my house to log to a central location, so that log messages can be So I needed to set up my internal Ubuntu-based server to receive log messages from these devices via the syslog protocol. My requirements were: It took me a while to figure out how the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,34,122,33,84,134,86],"tags":[388,387],"class_list":["post-1877","post","type-post","status-publish","format-standard","hentry","category-computers","category-debian","category-english","category-linux-computers","category-networking-computers","category-routers","category-ubuntu","tag-logging","tag-syslog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>rsyslog Configuration for remote Logging - Ralf&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"rsyslog Configuration for remote Logging - Ralf&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"I want all the network devices in my house to log to a central location, so that log messages can be So I needed to set up my internal Ubuntu-based server to receive log messages from these devices via the syslog protocol. My requirements were: It took me a while to figure out how the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/\" \/>\n<meta property=\"og:site_name\" content=\"Ralf&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-09-28T15:39:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-28T15:42:24+00:00\" \/>\n<meta name=\"author\" content=\"Ralf Bergs\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ralfbergs\" \/>\n<meta name=\"twitter:site\" content=\"@ralfbergs\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ralf Bergs\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/2024\\\/09\\\/28\\\/rsyslog-configuration-for-remote-logging\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/2024\\\/09\\\/28\\\/rsyslog-configuration-for-remote-logging\\\/\"},\"author\":{\"name\":\"Ralf Bergs\",\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/#\\\/schema\\\/person\\\/354e37390b493c875f972bd313d29201\"},\"headline\":\"rsyslog Configuration for remote Logging\",\"datePublished\":\"2024-09-28T15:39:48+00:00\",\"dateModified\":\"2024-09-28T15:42:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/2024\\\/09\\\/28\\\/rsyslog-configuration-for-remote-logging\\\/\"},\"wordCount\":226,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/#\\\/schema\\\/person\\\/354e37390b493c875f972bd313d29201\"},\"keywords\":[\"logging\",\"syslog\"],\"articleSection\":[\"Computers\",\"Debian\",\"English\",\"Linux\",\"Networking\",\"Routers\",\"Ubuntu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/bergs.biz\\\/blog\\\/2024\\\/09\\\/28\\\/rsyslog-configuration-for-remote-logging\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/2024\\\/09\\\/28\\\/rsyslog-configuration-for-remote-logging\\\/\",\"url\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/2024\\\/09\\\/28\\\/rsyslog-configuration-for-remote-logging\\\/\",\"name\":\"rsyslog Configuration for remote Logging - Ralf&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/#website\"},\"datePublished\":\"2024-09-28T15:39:48+00:00\",\"dateModified\":\"2024-09-28T15:42:24+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/2024\\\/09\\\/28\\\/rsyslog-configuration-for-remote-logging\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/bergs.biz\\\/blog\\\/2024\\\/09\\\/28\\\/rsyslog-configuration-for-remote-logging\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/2024\\\/09\\\/28\\\/rsyslog-configuration-for-remote-logging\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"rsyslog Configuration for remote Logging\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/\",\"name\":\"Ralf's Blog\",\"description\":\"Just another WordPress weblog\",\"publisher\":{\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/#\\\/schema\\\/person\\\/354e37390b493c875f972bd313d29201\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/#\\\/schema\\\/person\\\/354e37390b493c875f972bd313d29201\",\"name\":\"Ralf Bergs\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/Ralf-Tower-2026-1024x1024.jpg\",\"url\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/Ralf-Tower-2026-1024x1024.jpg\",\"contentUrl\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/Ralf-Tower-2026-1024x1024.jpg\",\"width\":1024,\"height\":1024,\"caption\":\"Ralf Bergs\"},\"logo\":{\"@id\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/Ralf-Tower-2026-1024x1024.jpg\"},\"description\":\"Geek, computer guy, licensed and certified electrical and computer engineer, husband, best daddy.\",\"sameAs\":[\"https:\\\/\\\/bergs.biz\\\/\",\"https:\\\/\\\/linkedin.com\\\/in\\\/ralfbergs\\\/\",\"https:\\\/\\\/x.com\\\/ralfbergs\"],\"url\":\"https:\\\/\\\/bergs.biz\\\/blog\\\/author\\\/rabe\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"rsyslog Configuration for remote Logging - Ralf&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/","og_locale":"en_US","og_type":"article","og_title":"rsyslog Configuration for remote Logging - Ralf&#039;s Blog","og_description":"I want all the network devices in my house to log to a central location, so that log messages can be So I needed to set up my internal Ubuntu-based server to receive log messages from these devices via the syslog protocol. My requirements were: It took me a while to figure out how the [&hellip;]","og_url":"https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/","og_site_name":"Ralf&#039;s Blog","article_published_time":"2024-09-28T15:39:48+00:00","article_modified_time":"2024-09-28T15:42:24+00:00","author":"Ralf Bergs","twitter_card":"summary_large_image","twitter_creator":"@ralfbergs","twitter_site":"@ralfbergs","twitter_misc":{"Written by":"Ralf Bergs","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/#article","isPartOf":{"@id":"https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/"},"author":{"name":"Ralf Bergs","@id":"https:\/\/bergs.biz\/blog\/#\/schema\/person\/354e37390b493c875f972bd313d29201"},"headline":"rsyslog Configuration for remote Logging","datePublished":"2024-09-28T15:39:48+00:00","dateModified":"2024-09-28T15:42:24+00:00","mainEntityOfPage":{"@id":"https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/"},"wordCount":226,"commentCount":0,"publisher":{"@id":"https:\/\/bergs.biz\/blog\/#\/schema\/person\/354e37390b493c875f972bd313d29201"},"keywords":["logging","syslog"],"articleSection":["Computers","Debian","English","Linux","Networking","Routers","Ubuntu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/","url":"https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/","name":"rsyslog Configuration for remote Logging - Ralf&#039;s Blog","isPartOf":{"@id":"https:\/\/bergs.biz\/blog\/#website"},"datePublished":"2024-09-28T15:39:48+00:00","dateModified":"2024-09-28T15:42:24+00:00","breadcrumb":{"@id":"https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/bergs.biz\/blog\/2024\/09\/28\/rsyslog-configuration-for-remote-logging\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/bergs.biz\/blog\/"},{"@type":"ListItem","position":2,"name":"rsyslog Configuration for remote Logging"}]},{"@type":"WebSite","@id":"https:\/\/bergs.biz\/blog\/#website","url":"https:\/\/bergs.biz\/blog\/","name":"Ralf's Blog","description":"Just another WordPress weblog","publisher":{"@id":"https:\/\/bergs.biz\/blog\/#\/schema\/person\/354e37390b493c875f972bd313d29201"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/bergs.biz\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/bergs.biz\/blog\/#\/schema\/person\/354e37390b493c875f972bd313d29201","name":"Ralf Bergs","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2026\/04\/Ralf-Tower-2026-1024x1024.jpg","url":"https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2026\/04\/Ralf-Tower-2026-1024x1024.jpg","contentUrl":"https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2026\/04\/Ralf-Tower-2026-1024x1024.jpg","width":1024,"height":1024,"caption":"Ralf Bergs"},"logo":{"@id":"https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2026\/04\/Ralf-Tower-2026-1024x1024.jpg"},"description":"Geek, computer guy, licensed and certified electrical and computer engineer, husband, best daddy.","sameAs":["https:\/\/bergs.biz\/","https:\/\/linkedin.com\/in\/ralfbergs\/","https:\/\/x.com\/ralfbergs"],"url":"https:\/\/bergs.biz\/blog\/author\/rabe\/"}]}},"_links":{"self":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts\/1877","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/comments?post=1877"}],"version-history":[{"count":3,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts\/1877\/revisions"}],"predecessor-version":[{"id":1881,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts\/1877\/revisions\/1881"}],"wp:attachment":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/media?parent=1877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/categories?post=1877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/tags?post=1877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}