<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Logs on Nerdsid.com</title><link>https://nerdsid.com/tags/logs/</link><description>Recent content in Logs on Nerdsid.com</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 30 Jun 2026 11:41:54 +0000</lastBuildDate><atom:link href="https://nerdsid.com/tags/logs/index.xml" rel="self" type="application/rss+xml"/><item><title>Practical Grep: Filtering Errors and Patterns in Log Files</title><link>https://nerdsid.com/posts/practical-grep-filtering-errors-and-patterns-in-log-files/</link><pubDate>Tue, 30 Jun 2026 11:41:54 +0000</pubDate><guid>https://nerdsid.com/posts/practical-grep-filtering-errors-and-patterns-in-log-files/</guid><description>&lt;h2 id="introduction">Introduction&lt;/h2>
&lt;p>This walkthrough covers using grep to search and filter log files for errors, specific requests, and multi-pattern matches.&lt;/p>
&lt;h2 id="tasks">Tasks&lt;/h2>
&lt;ol>
&lt;li>Find all &lt;code>ERROR&lt;/code> messages in &lt;code>system.log&lt;/code> and count how many there are.&lt;/li>
&lt;li>Find all lines containing &lt;code>POST&lt;/code> requests in &lt;code>access.log&lt;/code>.&lt;/li>
&lt;li>Find all lines in &lt;code>application.log&lt;/code> that contain both &lt;code>WARNING&lt;/code> and &lt;code>query&lt;/code> (case-insensitive).&lt;/li>
&lt;li>Search for all user authentications (containing &lt;code>User authenticated&lt;/code>) across all log files.&lt;/li>
&lt;/ol>
&lt;h3 id="requirements">Requirements&lt;/h3>
&lt;ul>
&lt;li>Use &lt;code>grep&lt;/code> for all searches (combining with other commands like &lt;code>wc&lt;/code> where needed).&lt;/li>
&lt;li>Save each task&amp;rsquo;s output to its own file: &lt;code>task1_output.txt&lt;/code>, &lt;code>task2_output.txt&lt;/code>, &lt;code>task3_output.txt&lt;/code>, &lt;code>task4_output.txt&lt;/code>.&lt;/li>
&lt;li>Original log files must not be modified.&lt;/li>
&lt;/ul>
&lt;h2 id="solution">Solution&lt;/h2>
&lt;h3 id="task-1">Task 1&lt;/h3>






&lt;div class="codeblock">
 &lt;div class="codeblock__header">
 &lt;div class="codeblock__filename codeblock__filename--lang">
 
 BASH
 
 &lt;/div>
 &lt;div class="codeblock__actions">
 
 &lt;/div>
 &lt;/div>
 &lt;div class="codeblock__body">
 &lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">grep -c &lt;span class="s2">&amp;#34;ERROR&amp;#34;&lt;/span> system.log &amp;gt; task1_output.txt&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
 &lt;/div>
&lt;/div>&lt;p>&lt;code>grep -c&lt;/code> counts the number of matching lines instead of printing them. Redirecting the output saves the count to task1_output.txt.&lt;/p></description></item><item><title>Linux Journalctl Command Cheat Sheet</title><link>https://nerdsid.com/posts/linux-journalctl-cheatsheet/</link><pubDate>Wed, 15 Apr 2026 06:39:17 +0000</pubDate><guid>https://nerdsid.com/posts/linux-journalctl-cheatsheet/</guid><description>&lt;p>I recently needed to free up disk space by removing old system logs, so I collected the command I used and other useful journalctl commands for future reference.&lt;/p>
&lt;h2 id="disk-usage--vacuum-remove-old-logs">Disk usage &amp;amp; vacuum (remove old logs)&lt;/h2>
&lt;p>Show journal disk usage:&lt;/p>






&lt;div class="codeblock">
 &lt;div class="codeblock__header">
 &lt;div class="codeblock__filename codeblock__filename--lang">
 
 BASH
 
 &lt;/div>
 &lt;div class="codeblock__actions">
 
 &lt;/div>
 &lt;/div>
 &lt;div class="codeblock__body">
 &lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sudo journalctl --disk-usage&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
 &lt;/div>
&lt;/div>&lt;p>Remove archived journal files until total size is below X:&lt;/p>






&lt;div class="codeblock">
 &lt;div class="codeblock__header">
 &lt;div class="codeblock__filename codeblock__filename--lang">
 
 BASH
 
 &lt;/div>
 &lt;div class="codeblock__actions">
 
 &lt;/div>
 &lt;/div>
 &lt;div class="codeblock__body">
 &lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sudo journalctl --vacuum-size&lt;span class="o">=&lt;/span>500M&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
 &lt;/div>
&lt;/div>&lt;p>Remove archived journal files older than a time:&lt;/p>






&lt;div class="codeblock">
 &lt;div class="codeblock__header">
 &lt;div class="codeblock__filename codeblock__filename--lang">
 
 BASH
 
 &lt;/div>
 &lt;div class="codeblock__actions">
 
 &lt;/div>
 &lt;/div>
 &lt;div class="codeblock__body">
 &lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sudo journalctl --vacuum-time&lt;span class="o">=&lt;/span>3d&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
 &lt;/div>
&lt;/div>&lt;p>Remove archived journal files, keeping only the most recent N files:&lt;/p></description></item><item><title>4 Ways to Watch Logs Live in Linux</title><link>https://nerdsid.com/posts/watch-logs-live-in-linux/</link><pubDate>Wed, 15 Oct 2025 12:49:55 +0530</pubDate><guid>https://nerdsid.com/posts/watch-logs-live-in-linux/</guid><description>&lt;h2 id="1-tail--f">1. &lt;code>tail -f&lt;/code>&lt;/h2>
&lt;p>&lt;strong>Use when:&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>You want to quickly stream a log file.&lt;/li>
&lt;li>You want to perform short, one-off checks on a single log file.&lt;/li>
&lt;/ul>
&lt;!-- - Great for one-off checks, ad-hoc debugging (like checking `nginx/access.log` or `app.log`). -->
&lt;p>&lt;strong>Availibility&lt;/strong>: available on all Linux/Unix systems.&lt;/p>
&lt;p>&lt;strong>Example:&lt;/strong>&lt;/p>






&lt;div class="codeblock">
 &lt;div class="codeblock__header">
 &lt;div class="codeblock__filename codeblock__filename--lang">
 
 BASH
 
 &lt;/div>
 &lt;div class="codeblock__actions">
 
 &lt;/div>
 &lt;/div>
 &lt;div class="codeblock__body">
 &lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">tail -f /var/log/syslog&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
 &lt;/div>
&lt;/div>&lt;h2 id="2-tail--f">2. &lt;code>tail -F&lt;/code>&lt;/h2>
&lt;p>Some services (like Nginx, Apache) &lt;strong>rotate logs&lt;/strong> i.e. they stop writing logs to an old file and instead write to a new file (named sequentially).
&lt;code>tail -f&lt;/code> stops following when that happens, but &lt;code>tail -F&lt;/code> automatically switches to the new file. In other words, it handles log rotation gracefully.&lt;/p></description></item></channel></rss>