{"id":897,"date":"2022-10-24T13:31:07","date_gmt":"2022-10-24T06:31:07","guid":{"rendered":"https:\/\/insideofcode.com\/blog\/?p=897"},"modified":"2023-11-15T10:26:11","modified_gmt":"2023-11-15T03:26:11","slug":"how-to-clean-journalctl-logs","status":"publish","type":"post","link":"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/","title":{"rendered":"How to clean journalctl logs"},"content":{"rendered":"\n<p>The self maintenance method is to vacuum the logs by size or time. <\/p>\n\n\n\n<p>Retain only the past one day:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">journalctl --vacuum-time=1d<\/code><\/pre>\n\n\n\n<p>Retain only the past only 100 MB:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">journalctl --vacuum-size=100M<\/code><\/pre>\n\n\n\n<p>You can also limit the log file size by doing a little configuration in the following file.<\/p>\n\n\n\n<pre title=\"\/etc\/systemd\/journald.conf\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">...\nSystemMaxUse=100M\n...<\/code><\/pre>\n\n\n\n<p>The configuration will run when the server is restarted or restarted of the journald service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">systemctl restart systemd-journald<\/code><\/pre>\n\n\n\n<p>For more information you can talk about it in the journalctl documentation with the command <code>'man journalctl'<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>journalctl logs can be so large they take up storage, sometimes we need to clean them up<\/p>\n","protected":false},"author":1,"featured_media":906,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[155,212,215],"tags":[],"class_list":["post-897","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server-tutorial","category-tips-en","category-linux-tutorial-en"],"blocksy_meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to clean journalctl logs - Inside of Code<\/title>\n<meta name=\"description\" content=\"journalctl logs can be so large they take up storage, sometimes we need to clean them up.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to clean journalctl logs - Inside of Code\" \/>\n<meta property=\"og:description\" content=\"journalctl logs can be so large they take up storage, sometimes we need to clean them up.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/\" \/>\n<meta property=\"og:site_name\" content=\"Inside of Code\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-24T06:31:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-15T03:26:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/cover-journalctl-logs.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Dani\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dani\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/\"},\"author\":{\"name\":\"Dani\",\"@id\":\"https:\/\/insideofcode.com\/blog\/#\/schema\/person\/1c6cafc6659067aa7ac1fd1a5ced218d\"},\"headline\":\"How to clean journalctl logs\",\"datePublished\":\"2022-10-24T06:31:07+00:00\",\"dateModified\":\"2023-11-15T03:26:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/\"},\"wordCount\":77,\"publisher\":{\"@id\":\"https:\/\/insideofcode.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/cover-journalctl-logs.webp\",\"articleSection\":[\"Server\",\"Tips\",\"Tutorial Linux\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/\",\"url\":\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/\",\"name\":\"How to clean journalctl logs - Inside of Code\",\"isPartOf\":{\"@id\":\"https:\/\/insideofcode.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/cover-journalctl-logs.webp\",\"datePublished\":\"2022-10-24T06:31:07+00:00\",\"dateModified\":\"2023-11-15T03:26:11+00:00\",\"description\":\"journalctl logs can be so large they take up storage, sometimes we need to clean them up.\",\"breadcrumb\":{\"@id\":\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#primaryimage\",\"url\":\"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/cover-journalctl-logs.webp\",\"contentUrl\":\"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/cover-journalctl-logs.webp\",\"width\":1280,\"height\":720,\"caption\":\"How to clear journalctl logs\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/insideofcode.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to clean journalctl logs\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/insideofcode.com\/blog\/#website\",\"url\":\"https:\/\/insideofcode.com\/blog\/\",\"name\":\"Inside of Code\",\"description\":\"A software engineer who wants to share what he has learned, and document his journey.\",\"publisher\":{\"@id\":\"https:\/\/insideofcode.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/insideofcode.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/insideofcode.com\/blog\/#organization\",\"name\":\"Inside of Code\",\"url\":\"https:\/\/insideofcode.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/insideofcode.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/logo-ioc.png\",\"contentUrl\":\"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/logo-ioc.png\",\"width\":324,\"height\":324,\"caption\":\"Inside of Code\"},\"image\":{\"@id\":\"https:\/\/insideofcode.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/insideofcode.com\/blog\/#\/schema\/person\/1c6cafc6659067aa7ac1fd1a5ced218d\",\"name\":\"Dani\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/insideofcode.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a4b1e4251720747aef0418e09fe0f6e7786ff89358b57f76822f1c52c286552b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a4b1e4251720747aef0418e09fe0f6e7786ff89358b57f76822f1c52c286552b?s=96&d=mm&r=g\",\"caption\":\"Dani\"},\"sameAs\":[\"https:\/\/insideofcode.com\/blog\"],\"url\":\"https:\/\/insideofcode.com\/blog\/author\/daniwork\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to clean journalctl logs - Inside of Code","description":"journalctl logs can be so large they take up storage, sometimes we need to clean them up.","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:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/","og_locale":"en_US","og_type":"article","og_title":"How to clean journalctl logs - Inside of Code","og_description":"journalctl logs can be so large they take up storage, sometimes we need to clean them up.","og_url":"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/","og_site_name":"Inside of Code","article_published_time":"2022-10-24T06:31:07+00:00","article_modified_time":"2023-11-15T03:26:11+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/cover-journalctl-logs.webp","type":"image\/webp"}],"author":"Dani","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Dani"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#article","isPartOf":{"@id":"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/"},"author":{"name":"Dani","@id":"https:\/\/insideofcode.com\/blog\/#\/schema\/person\/1c6cafc6659067aa7ac1fd1a5ced218d"},"headline":"How to clean journalctl logs","datePublished":"2022-10-24T06:31:07+00:00","dateModified":"2023-11-15T03:26:11+00:00","mainEntityOfPage":{"@id":"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/"},"wordCount":77,"publisher":{"@id":"https:\/\/insideofcode.com\/blog\/#organization"},"image":{"@id":"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#primaryimage"},"thumbnailUrl":"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/cover-journalctl-logs.webp","articleSection":["Server","Tips","Tutorial Linux"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/","url":"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/","name":"How to clean journalctl logs - Inside of Code","isPartOf":{"@id":"https:\/\/insideofcode.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#primaryimage"},"image":{"@id":"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#primaryimage"},"thumbnailUrl":"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/cover-journalctl-logs.webp","datePublished":"2022-10-24T06:31:07+00:00","dateModified":"2023-11-15T03:26:11+00:00","description":"journalctl logs can be so large they take up storage, sometimes we need to clean them up.","breadcrumb":{"@id":"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#primaryimage","url":"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/cover-journalctl-logs.webp","contentUrl":"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/cover-journalctl-logs.webp","width":1280,"height":720,"caption":"How to clear journalctl logs"},{"@type":"BreadcrumbList","@id":"https:\/\/insideofcode.com\/blog\/how-to-clean-journalctl-logs\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/insideofcode.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to clean journalctl logs"}]},{"@type":"WebSite","@id":"https:\/\/insideofcode.com\/blog\/#website","url":"https:\/\/insideofcode.com\/blog\/","name":"Inside of Code","description":"A software engineer who wants to share what he has learned, and document his journey.","publisher":{"@id":"https:\/\/insideofcode.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/insideofcode.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/insideofcode.com\/blog\/#organization","name":"Inside of Code","url":"https:\/\/insideofcode.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/insideofcode.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/logo-ioc.png","contentUrl":"https:\/\/insideofcode.com\/wp-content\/uploads\/2022\/10\/logo-ioc.png","width":324,"height":324,"caption":"Inside of Code"},"image":{"@id":"https:\/\/insideofcode.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/insideofcode.com\/blog\/#\/schema\/person\/1c6cafc6659067aa7ac1fd1a5ced218d","name":"Dani","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/insideofcode.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a4b1e4251720747aef0418e09fe0f6e7786ff89358b57f76822f1c52c286552b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a4b1e4251720747aef0418e09fe0f6e7786ff89358b57f76822f1c52c286552b?s=96&d=mm&r=g","caption":"Dani"},"sameAs":["https:\/\/insideofcode.com\/blog"],"url":"https:\/\/insideofcode.com\/blog\/author\/daniwork\/"}]}},"_links":{"self":[{"href":"https:\/\/insideofcode.com\/blog\/wp-json\/wp\/v2\/posts\/897","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/insideofcode.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/insideofcode.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/insideofcode.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/insideofcode.com\/blog\/wp-json\/wp\/v2\/comments?post=897"}],"version-history":[{"count":0,"href":"https:\/\/insideofcode.com\/blog\/wp-json\/wp\/v2\/posts\/897\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/insideofcode.com\/blog\/wp-json\/wp\/v2\/media\/906"}],"wp:attachment":[{"href":"https:\/\/insideofcode.com\/blog\/wp-json\/wp\/v2\/media?parent=897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/insideofcode.com\/blog\/wp-json\/wp\/v2\/categories?post=897"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/insideofcode.com\/blog\/wp-json\/wp\/v2\/tags?post=897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}