{"id":9989,"date":"2021-02-16T05:15:12","date_gmt":"2021-02-15T19:15:12","guid":{"rendered":"https:\/\/nsrd.info\/blog\/?p=9989"},"modified":"2021-02-16T05:16:41","modified_gmt":"2021-02-15T19:16:41","slug":"networker-basics-let-nsr_render_log-b-your-friend","status":"publish","type":"post","link":"https:\/\/nsrd.info\/blog\/2021\/02\/16\/networker-basics-let-nsr_render_log-b-your-friend\/","title":{"rendered":"NetWorker Basics \u2013\u00a0Let nsr_render_log B your friend"},"content":{"rendered":"\n<p>A <strong><a href=\"https:\/\/nsrd.info\/blog\/2009\/07\/28\/basics-realtime-rendered-logs-and-other-log-options\/\" target=\"_blank\" rel=\"noreferrer noopener\">post from a long time ago<\/a><\/strong> explained how you could enable realtime rendering of NetWorker logs from their raw to human-readable formats.<\/p>\n\n\n\n<p>If you can enable realtime rendering, it makes for easy reviews of NetWorker logs. But you may not always have an option, particularly on clients throughout your environment. Some client systems may have capacity constraints (real or imagined), or you might only have access to systems if there&#8217;s a problem to be fixed.<\/p>\n\n\n\n<p>If you come from a Unix background, you&#8217;d undoubtedly be familiar with the commands:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>tail -f, and<\/li><li>tail -Xf (where X is a number)<\/li><\/ul>\n\n\n\n<p>The first instance of tail lets you starting watching a log in real-time from the last 10 lines in the log, and the second lets you specify how many lines you want to go back.<\/p>\n\n\n\n<p>Unless you enable real-time rendering of logs, you won&#8217;t get that &#8220;tail&#8221; luxury of seeing the logs continuously update in a shell session. But that doesn&#8217;t mean <strong>nsr_render_log<\/strong> lacks tools to help you get to what you need.<\/p>\n\n\n\n<p>If you&#8217;re after just a range of time (or to be more correct the time <em>and<\/em> date) within the log rendering, you can invoke <strong>nsr_render_log<\/strong> with a -S <em>start<\/em> and -E <em>end<\/em> option. I love that the start and end times can be specified in any NetWorker time format though! So you can be specific with &#8220;-S 30\/12\/2020 14:59:01&#8221; -E &#8220;31\/12\/2020 01:59:33&#8221;, but you can also be a little more imprecise in the time statements \u2013&nbsp;&#8220;-S 33 hours ago&#8221; -E &#8220;14 hours ago&#8221;. <\/p>\n\n\n\n<p>If you&#8217;re just after a block of lines, you can use the -B option \u2013&nbsp;and better yet, if you specify a <strong><em>negative<\/em><\/strong> number, <strong>nsr_render_log<\/strong> will pull those details from the end of the file. For example:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-B.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1874\" height=\"1101\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-B.png\" alt=\"Using nsr_render_log -B\" class=\"wp-image-9992\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-B.png 1874w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-B-300x176.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-B-1024x602.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-B-768x451.png 768w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-B-1536x902.png 1536w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-B-1600x940.png 1600w\" sizes=\"auto, (max-width: 1874px) 100vw, 1874px\" \/><\/a><figcaption>Using <strong>nsr_render_log<\/strong> -B<\/figcaption><\/figure>\n\n\n\n<p>In the above example, I&#8217;ve invoked <strong>nsr_render_log<\/strong> with an argument of &#8220;-B -15&#8221; which means, &#8220;grab the last 15 lines of the log file&#8221;. This is really handy if you&#8217;re just wanting to see the latest content from the log.<\/p>\n\n\n\n<p>But, if you&#8217;re a NetWorker administrator who doesn&#8217;t have login access to the agent-based clients within your environment, you can go one better than the above by doing a <em>remote<\/em> grab of the client logs from the command line. That&#8217;s right, from the NetWorker server you can invoke <strong>nsr_render_log<\/strong> using an option of <em>-R client<\/em> to retrieve the rendered log details from a client. So below you&#8217;ll see me running the command from my backup server, again requesting the tail end of the log from my client:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-R_-B.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1874\" height=\"1101\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-R_-B.jpg\" alt=\"Using nsr_render_log from the NetWorker server for a remote client\" class=\"wp-image-9996\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-R_-B.jpg 1874w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-R_-B-300x176.jpg 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-R_-B-1024x602.jpg 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-R_-B-768x451.jpg 768w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-R_-B-1536x902.jpg 1536w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-R_-B-1600x940.jpg 1600w\" sizes=\"auto, (max-width: 1874px) 100vw, 1874px\" \/><\/a><figcaption>Using <strong>nsr_render_log<\/strong> from the NetWorker server for a remote client<\/figcaption><\/figure>\n\n\n\n<p>When you run <strong>nsr_render_log<\/strong> remotely, you&#8217;re not just limited to using the -B option, either. For instance, you can use those start and stop time options as well:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-S_-E_-R.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1874\" height=\"1101\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-S_-E_-R.jpg\" alt=\"nsr_render_log rendering remote logs within a time range\" class=\"wp-image-9998\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-S_-E_-R.jpg 1874w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-S_-E_-R-300x176.jpg 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-S_-E_-R-1024x602.jpg 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-S_-E_-R-768x451.jpg 768w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-S_-E_-R-1536x902.jpg 1536w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/02\/nsr_render_log_-S_-E_-R-1600x940.jpg 1600w\" sizes=\"auto, (max-width: 1874px) 100vw, 1874px\" \/><\/a><figcaption><strong>nsr_render_log<\/strong> rendering remote logs within a time range<\/figcaption><\/figure>\n\n\n\n<p>I often under-think the <strong>nsr_render_log<\/strong> utility. I tend to think of it as something that I run from the client to dump output that I&#8217;ll manually scan through. But it&#8217;s a lot more intelligent \u2014&nbsp;as you can see from the above examples, you can exercise considerable precision in picking out how many lines, what date range or what client you want the logs from.<\/p>\n\n\n\n<p><em>That&#8217;s still not all<\/em>, though! Using appropriate arguments, you can get <strong>nsr_render_log<\/strong> to output information only relating to specific processes, programs, hostnames, devices, and a variety of other options, too. (You can find more details on those options in the man page for <strong>nsr_render_log<\/strong>, or the command line reference guide for NetWorker.)<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>Before I sign off: I&#8217;ve started a new blog that explores tech \u2013 and working in tech \u2013\u00a0more broadly. You can see what I&#8217;m up to on that blog over at <strong><a href=\"https:\/\/musingabout.tech\" target=\"_blank\" rel=\"noreferrer noopener\">Musing About Tech<\/a><\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A post from a long time ago explained how you could enable realtime rendering of NetWorker logs from their raw&hellip;<\/p>\n","protected":false},"author":1,"featured_media":6586,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6,16],"tags":[682],"class_list":["post-9989","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-basics","category-networker","tag-nsr_render_log"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2018\/01\/bigStock-HDD-Magnifying-Glass.jpg","jetpack_shortlink":"https:\/\/wp.me\/pKpIN-2B7","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/9989","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/comments?post=9989"}],"version-history":[{"count":4,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/9989\/revisions"}],"predecessor-version":[{"id":10009,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/9989\/revisions\/10009"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media\/6586"}],"wp:attachment":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media?parent=9989"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/categories?post=9989"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/tags?post=9989"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}