{"id":5059,"date":"2024-03-19T14:24:49","date_gmt":"2024-03-19T21:24:49","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=5059"},"modified":"2024-03-19T14:24:51","modified_gmt":"2024-03-19T21:24:51","slug":"how-to-log-messages-from-a-remote-host-to-a-specific-file-in-rsyslog","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=5059","title":{"rendered":"How to Log Messages from a Remote Host to a Specific File in Rsyslog"},"content":{"rendered":"\n<p>Sometimes, you may want to save the log from a remote server to a specific file instead of \/var\/log\/messages. you can set up log forwarding later that won&#8217;t include lots of junk.<\/p>\n\n\n\n<p><strong>Step 1<\/strong><\/p>\n\n\n\n<p>Create a new conf file in \/etc\/rsyslog.d with below two lines, for example. we are going to save the log messages from a host called DarkTrace2LogScale to a log file \/var\/log\/darktrace.log. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if $fromhost == 'DarkTrace2LogScale' then \/var\/log\/darktrace.log\n&amp; stop<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"808\" height=\"72\" src=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image.png\" alt=\"\" class=\"wp-image-5060\" srcset=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image.png 808w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image-300x27.png 300w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image-768x68.png 768w\" sizes=\"(max-width: 808px) 100vw, 808px\" \/><\/figure>\n\n\n\n<p><strong>Step 2<\/strong><\/p>\n\n\n\n<p>Create a new log file for this purpose and then restart the rsyslog service.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"520\" height=\"51\" src=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image-1.png\" alt=\"\" class=\"wp-image-5061\" srcset=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image-1.png 520w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image-1-300x29.png 300w\" sizes=\"(max-width: 520px) 100vw, 520px\" \/><\/figure>\n\n\n\n<p><strong>Step 3<\/strong><\/p>\n\n\n\n<p>Verify the configuration is actually working.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"224\" src=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image-2-1024x224.png\" alt=\"\" class=\"wp-image-5062\" srcset=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image-2-1024x224.png 1024w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image-2-300x66.png 300w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image-2-768x168.png 768w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image-2-1536x337.png 1536w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image-2.png 1894w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes, you may want to save the log from a remote server to a specific file instead of \/var\/log\/messages. you can set up log forwarding later that won&#8217;t include lots of junk. Step 1 Create a new conf file in \/etc\/rsyslog.d with below two lines, for example. we are going to save the log messages <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=5059\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[262,5],"tags":[1771,1772],"class_list":["post-5059","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux","tag-how-to-save-log-messages-to-a-specific-file-in-rsyslog","tag-rsyslog-log-messages-to-a-specific-file"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"Sometimes, you may want to save the log from a remote server to a specific file instead of \/var\/log\/messages. you can set up log forwarding later that won&#039;t include lots of junk. Step 1 Create a new conf file in \/etc\/rsyslog.d with below two lines, for example. we are going to save the log messages\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Summa Lai\"\/>\n\t<meta name=\"keywords\" content=\"how to save log messages to a specific file in rsyslog,rsyslog log messages to a specific file,centos,linux family\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/SUMMALAI.COM\/?p=5059\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=5059#article\",\"name\":\"How to Log Messages from a Remote Host to a Specific File in Rsyslog | Summa Lai\",\"headline\":\"How to Log Messages from a Remote Host to a Specific File in Rsyslog\",\"author\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?author=2#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/SUMMALAI.COM\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/image.png\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=5059\\\/#articleImage\",\"width\":808,\"height\":72},\"datePublished\":\"2024-03-19T14:24:49-07:00\",\"dateModified\":\"2024-03-19T14:24:51-07:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=5059#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=5059#webpage\"},\"articleSection\":\"CentOS, Linux Family, How to Save Log Messages to a Specific File in Rsyslog, Rsyslog Log Messages to a Specific File\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=5059#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/SUMMALAI.COM\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=5#listItem\",\"name\":\"Linux Family\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=5#listItem\",\"position\":2,\"name\":\"Linux Family\",\"item\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=5\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=262#listItem\",\"name\":\"CentOS\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=262#listItem\",\"position\":3,\"name\":\"CentOS\",\"item\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=262\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=5059#listItem\",\"name\":\"How to Log Messages from a Remote Host to a Specific File in Rsyslog\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=5#listItem\",\"name\":\"Linux Family\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=5059#listItem\",\"position\":4,\"name\":\"How to Log Messages from a Remote Host to a Specific File in Rsyslog\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=262#listItem\",\"name\":\"CentOS\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/#person\",\"name\":\"sladmin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=5059#personImage\",\"url\":\"https:\\\/\\\/SUMMALAI.COM\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/Summa_Logo-150x150.png\",\"width\":96,\"height\":96,\"caption\":\"sladmin\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?author=2#author\",\"url\":\"https:\\\/\\\/SUMMALAI.COM\\\/?author=2\",\"name\":\"Summa Lai\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=5059#authorImage\",\"url\":\"https:\\\/\\\/SUMMALAI.COM\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/Summa_Logo-150x150.png\",\"width\":96,\"height\":96,\"caption\":\"Summa Lai\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=5059#webpage\",\"url\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=5059\",\"name\":\"How to Log Messages from a Remote Host to a Specific File in Rsyslog | Summa Lai\",\"description\":\"Sometimes, you may want to save the log from a remote server to a specific file instead of \\\/var\\\/log\\\/messages. you can set up log forwarding later that won't include lots of junk. Step 1 Create a new conf file in \\\/etc\\\/rsyslog.d with below two lines, for example. we are going to save the log messages\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=5059#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?author=2#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?author=2#author\"},\"datePublished\":\"2024-03-19T14:24:49-07:00\",\"dateModified\":\"2024-03-19T14:24:51-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/#website\",\"url\":\"https:\\\/\\\/SUMMALAI.COM\\\/\",\"name\":\"Summa Lai\",\"description\":\"Never Stop Learning, Building a Little Wiki...\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How to Log Messages from a Remote Host to a Specific File in Rsyslog | Summa Lai","description":"Sometimes, you may want to save the log from a remote server to a specific file instead of \/var\/log\/messages. you can set up log forwarding later that won't include lots of junk. Step 1 Create a new conf file in \/etc\/rsyslog.d with below two lines, for example. we are going to save the log messages","canonical_url":"https:\/\/SUMMALAI.COM\/?p=5059","robots":"max-image-preview:large","keywords":"how to save log messages to a specific file in rsyslog,rsyslog log messages to a specific file,centos,linux family","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/SUMMALAI.COM\/?p=5059#article","name":"How to Log Messages from a Remote Host to a Specific File in Rsyslog | Summa Lai","headline":"How to Log Messages from a Remote Host to a Specific File in Rsyslog","author":{"@id":"https:\/\/SUMMALAI.COM\/?author=2#author"},"publisher":{"@id":"https:\/\/SUMMALAI.COM\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2024\/03\/image.png","@id":"https:\/\/SUMMALAI.COM\/?p=5059\/#articleImage","width":808,"height":72},"datePublished":"2024-03-19T14:24:49-07:00","dateModified":"2024-03-19T14:24:51-07:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/SUMMALAI.COM\/?p=5059#webpage"},"isPartOf":{"@id":"https:\/\/SUMMALAI.COM\/?p=5059#webpage"},"articleSection":"CentOS, Linux Family, How to Save Log Messages to a Specific File in Rsyslog, Rsyslog Log Messages to a Specific File"},{"@type":"BreadcrumbList","@id":"https:\/\/SUMMALAI.COM\/?p=5059#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM#listItem","position":1,"name":"Home","item":"https:\/\/SUMMALAI.COM","nextItem":{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?cat=5#listItem","name":"Linux Family"}},{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?cat=5#listItem","position":2,"name":"Linux Family","item":"https:\/\/SUMMALAI.COM\/?cat=5","nextItem":{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?cat=262#listItem","name":"CentOS"},"previousItem":{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?cat=262#listItem","position":3,"name":"CentOS","item":"https:\/\/SUMMALAI.COM\/?cat=262","nextItem":{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?p=5059#listItem","name":"How to Log Messages from a Remote Host to a Specific File in Rsyslog"},"previousItem":{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?cat=5#listItem","name":"Linux Family"}},{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?p=5059#listItem","position":4,"name":"How to Log Messages from a Remote Host to a Specific File in Rsyslog","previousItem":{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?cat=262#listItem","name":"CentOS"}}]},{"@type":"Person","@id":"https:\/\/SUMMALAI.COM\/#person","name":"sladmin","image":{"@type":"ImageObject","@id":"https:\/\/SUMMALAI.COM\/?p=5059#personImage","url":"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2020\/05\/Summa_Logo-150x150.png","width":96,"height":96,"caption":"sladmin"}},{"@type":"Person","@id":"https:\/\/SUMMALAI.COM\/?author=2#author","url":"https:\/\/SUMMALAI.COM\/?author=2","name":"Summa Lai","image":{"@type":"ImageObject","@id":"https:\/\/SUMMALAI.COM\/?p=5059#authorImage","url":"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2020\/05\/Summa_Logo-150x150.png","width":96,"height":96,"caption":"Summa Lai"}},{"@type":"WebPage","@id":"https:\/\/SUMMALAI.COM\/?p=5059#webpage","url":"https:\/\/SUMMALAI.COM\/?p=5059","name":"How to Log Messages from a Remote Host to a Specific File in Rsyslog | Summa Lai","description":"Sometimes, you may want to save the log from a remote server to a specific file instead of \/var\/log\/messages. you can set up log forwarding later that won't include lots of junk. Step 1 Create a new conf file in \/etc\/rsyslog.d with below two lines, for example. we are going to save the log messages","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/SUMMALAI.COM\/#website"},"breadcrumb":{"@id":"https:\/\/SUMMALAI.COM\/?p=5059#breadcrumblist"},"author":{"@id":"https:\/\/SUMMALAI.COM\/?author=2#author"},"creator":{"@id":"https:\/\/SUMMALAI.COM\/?author=2#author"},"datePublished":"2024-03-19T14:24:49-07:00","dateModified":"2024-03-19T14:24:51-07:00"},{"@type":"WebSite","@id":"https:\/\/SUMMALAI.COM\/#website","url":"https:\/\/SUMMALAI.COM\/","name":"Summa Lai","description":"Never Stop Learning, Building a Little Wiki...","inLanguage":"en-US","publisher":{"@id":"https:\/\/SUMMALAI.COM\/#person"}}]}},"aioseo_meta_data":{"post_id":"5059","title":null,"description":null,"keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2024-03-19 21:15:31","updated":"2024-03-19 21:24:52","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/SUMMALAI.COM\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/SUMMALAI.COM\/?cat=5\" title=\"Linux Family\">Linux Family<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/SUMMALAI.COM\/?cat=262\" title=\"CentOS\">CentOS<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow to Log Messages from a Remote Host to a Specific File in Rsyslog\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/SUMMALAI.COM"},{"label":"Linux Family","link":"https:\/\/SUMMALAI.COM\/?cat=5"},{"label":"CentOS","link":"https:\/\/SUMMALAI.COM\/?cat=262"},{"label":"How to Log Messages from a Remote Host to a Specific File in Rsyslog","link":"https:\/\/SUMMALAI.COM\/?p=5059"}],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/5059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5059"}],"version-history":[{"count":1,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/5059\/revisions"}],"predecessor-version":[{"id":5063,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/5059\/revisions\/5063"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}