<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Amritanshu Pandey</title>
    <description>The latest articles on DEV Community by Amritanshu Pandey (@amritanshupandey).</description>
    <link>https://dev.to/amritanshupandey</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F199322%2F7472a4cd-4bd0-4743-9ffd-ccdc15e0da3f.jpeg</url>
      <title>DEV Community: Amritanshu Pandey</title>
      <link>https://dev.to/amritanshupandey</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/amritanshupandey"/>
    <language>en</language>
    <item>
      <title>Setup NFS Storage Class on Kubernetes</title>
      <dc:creator>Amritanshu Pandey</dc:creator>
      <pubDate>Tue, 28 Sep 2021 13:00:36 +0000</pubDate>
      <link>https://dev.to/amritanshupandey/setup-nfs-storage-class-on-kubernetes-267c</link>
      <guid>https://dev.to/amritanshupandey/setup-nfs-storage-class-on-kubernetes-267c</guid>
      <description>&lt;p&gt;Create the following resources in order to setup an NFS storgae provisioner in a Kubernetes cluster. This allows creating Kubernetes volumes on an NFS server.&lt;/p&gt;

&lt;p&gt;Since the code required for creating various K8S resources for NFS provisioner is split into&lt;br&gt;
multiple files, I prefer to just clone this gist and using &lt;code&gt;kubectl&lt;/code&gt; to create all resources&lt;br&gt;
in one go&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git clone https://gist.github.com/amritanshu-pandey/8ab00179c98720cbc28d8bb0c7064426
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;8ab00179c98720cbc28d8bb0c7064426
&lt;span class="nv"&gt;$ &lt;/span&gt;kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt;.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;




&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;





&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This article was originally posted at &lt;a href="https://blog.amritanshu.in/posts/setup-nfs-storage-class-on-kubernetes/"&gt;https://blog.amritanshu.in/posts/setup-nfs-storage-class-on-kubernetes/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
    </item>
    <item>
      <title>Create self signed certificates for Kubernetes using cert-manager</title>
      <dc:creator>Amritanshu Pandey</dc:creator>
      <pubDate>Sat, 13 Feb 2021 21:37:22 +0000</pubDate>
      <link>https://dev.to/amritanshupandey/create-self-signed-certificates-for-kubernetes-using-cert-manager-403n</link>
      <guid>https://dev.to/amritanshupandey/create-self-signed-certificates-for-kubernetes-using-cert-manager-403n</guid>
      <description>&lt;h2&gt;
  
  
  Install Cert manager in Kubernetes
&lt;/h2&gt;

&lt;p&gt;Read this for up-to-date instructions: &lt;a href="https://cert-manager.io/docs/installation/kubernetes/"&gt;https://cert-manager.io/docs/installation/kubernetes/&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Kubernetes 1.16+&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;kubectl apply —validate&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; https://github.com/jetstack/cert-manager/releases/download/v1.0.2/cert-manager.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create a keypair secret
&lt;/h2&gt;

&lt;p&gt;In this step create a new k8s secret that contains the TLS CA cert and key that is used by cert manager to issue new certificates. As a prerequisite, we need a CA certificate and associated key encoded in base64.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Secret&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ca-key-pair&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="s"&gt;tls.crt&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;tls-key-base64-encoded&amp;gt;&lt;/span&gt;
  &lt;span class="s"&gt;tls.key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;tls-key-base64-encoded&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create an issuer
&lt;/h2&gt;

&lt;p&gt;Issuers are used by Cert manager to issue new certificates&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cert-manager.io/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Issuer&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ca-issuer&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;ca&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;secretName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ca-key-pair&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create certificates
&lt;/h2&gt;

&lt;p&gt;This creates new certificate using the issuer and CA key pair created earlier. In the following example, the certificate is stored as k8s secret &lt;code&gt;k8s-xps-lan&lt;/code&gt; in default namespace.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cert-manager.io/v1alpha2&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Certificate&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;k8s-xps-lan&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;secretName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;k8s-xps-lan&lt;/span&gt;
  &lt;span class="na"&gt;issuerRef&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ca-issuer&lt;/span&gt;
    &lt;span class="c1"&gt;# We can reference ClusterIssuers by changing the kind here.&lt;/span&gt;
    &lt;span class="c1"&gt;# The default value is Issuer (i.e. a locally namespaced Issuer)&lt;/span&gt;
    &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Issuer&lt;/span&gt;
  &lt;span class="na"&gt;commonName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;k8s.xps.lan&lt;/span&gt;
  &lt;span class="na"&gt;organization&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;XPS.LAN&lt;/span&gt;
  &lt;span class="na"&gt;dnsNames&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;gitlab.xps.lan&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;minio.xps.lan&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;registry.xps.lan&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;k8s.xps.lan&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;kibana.xps.lan&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;elastic.xps.lan&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a separate post, we will see how this certificate can be used by ingress-nginx and other applications.&lt;/p&gt;

</description>
      <category>kubernetes</category>
    </item>
    <item>
      <title>How to trigger Gitlab pipelines using REST API</title>
      <dc:creator>Amritanshu Pandey</dc:creator>
      <pubDate>Wed, 16 Dec 2020 11:15:40 +0000</pubDate>
      <link>https://dev.to/amritanshupandey/how-to-trigger-gitlab-pipelines-using-rest-api-3195</link>
      <guid>https://dev.to/amritanshupandey/how-to-trigger-gitlab-pipelines-using-rest-api-3195</guid>
      <description>&lt;p&gt;Gitlab pipelines are the CI(Continuous Integration) build job(s), that are usually triggered when a new commit is pushed to a git repository. Pipelines can be used to test, compile and deploy the code or to automate certain tasks. In addition to changes in git repositories, pipelines can also be triggered through other mechanisms as well. For instance:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Manually through the GitLab UI&lt;/li&gt;
&lt;li&gt;Based on a schedule&lt;/li&gt;
&lt;li&gt;Using GitLab's REST API&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In this article, I will explain how to trigger a GitLab pipeline using the GitLab's REST API.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create pipeline trigger
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to &lt;code&gt;project settings -&amp;gt; CI/CD -&amp;gt; Pipeline triggers&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create a new trigger and make note of the token. Token is used to authenticate the REST calls to trigger the pipeline.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--awMqqbWk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/l57l5z2zjeq0rt6ykfvf.png" alt="GitLab pipeline triggers"&gt;
&lt;/li&gt;
&lt;li&gt;Also make note of the URL displayed in the same page that must be used to trigger the pipeline. For e.g. &lt;code&gt;https://git.xps.lan/api/v4/projects/14/trigger/pipeline&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Trigger pipeline using &lt;code&gt;curl&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;This curl command can be used to trigger the pipeline for project with id &lt;code&gt;14&lt;/code&gt; for branch or tag specified as &lt;code&gt;ref&lt;/code&gt; in the curl command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="se"&gt;\&lt;/span&gt;
     &lt;span class="nt"&gt;-F&lt;/span&gt; &lt;span class="nv"&gt;token&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;token-noted-in-previous-step&amp;gt; &lt;span class="se"&gt;\&lt;/span&gt;
     &lt;span class="nt"&gt;-F&lt;/span&gt; &lt;span class="s2"&gt;"ref=&amp;lt;ref-name-like-branch-or-tag&amp;gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
     https://git.xps.lan/api/v4/projects/14/trigger/pipeline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sometime it might be required to pass on some variables to the pipeline while triggering the same. The variables passed while triggering the pipeline are available as environment variables at run time and takes precedence over all other variables.&lt;/p&gt;

&lt;p&gt;Following command will provide a variable named &lt;code&gt;RUN_NIGHTLY_BUILD&lt;/code&gt; with value as &lt;code&gt;true&lt;/code&gt; to the pipeline. Any number of variables can be provided like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="se"&gt;\&lt;/span&gt;
     &lt;span class="nt"&gt;-F&lt;/span&gt; &lt;span class="nv"&gt;token&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;token-noted-in-previous-step&amp;gt; &lt;span class="se"&gt;\&lt;/span&gt;
     &lt;span class="nt"&gt;-F&lt;/span&gt; &lt;span class="s2"&gt;"ref=&amp;lt;ref-name-like-branch-or-tag&amp;gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
     &lt;span class="nt"&gt;-F&lt;/span&gt; &lt;span class="s2"&gt;"variables[RUN_NIGHTLY_BUILD]=true"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
     https://git.xps.lan/api/v4/projects/14/trigger/pipeline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Using Powershell Invoke-WebRequest
&lt;/h2&gt;

&lt;p&gt;For the users on Windows, it might be bit easier to use Powershell and Invoke-WebRequest, rather than using &lt;code&gt;curl&lt;/code&gt; on Windows or WSL.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Invoke-WebRequest&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;https://git.xps.lan/api/v4/projects/14/trigger/pipeline&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;-Method&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;POST&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;-Body&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;@{&lt;/span&gt;&lt;span class="w"&gt;
         &lt;/span&gt;&lt;span class="s2"&gt;"token"&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;token-noted-in-previous-step&amp;gt;"&lt;/span&gt;&lt;span class="w"&gt;
         &lt;/span&gt;&lt;span class="s2"&gt;"ref"&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;ref-name-like-branch-or-tag&amp;gt;"&lt;/span&gt;&lt;span class="w"&gt;
         &lt;/span&gt;&lt;span class="s2"&gt;"variables[RUN_NIGHTLY_BUILD]"&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"true"&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>gitlab</category>
      <category>ci</category>
      <category>cd</category>
    </item>
    <item>
      <title>Install and manage multiple versions of python using Pyenv</title>
      <dc:creator>Amritanshu Pandey</dc:creator>
      <pubDate>Sun, 31 May 2020 05:47:35 +0000</pubDate>
      <link>https://dev.to/amritanshupandey/install-and-manage-multiple-versions-of-python-using-pyenv-2i3a</link>
      <guid>https://dev.to/amritanshupandey/install-and-manage-multiple-versions-of-python-using-pyenv-2i3a</guid>
      <description>&lt;p&gt;YouTube: &lt;iframe width="710" height="399" src="https://www.youtube.com/embed/JyimhcbZ-8w"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>python</category>
      <category>linux</category>
    </item>
    <item>
      <title>systemd-journald</title>
      <dc:creator>Amritanshu Pandey</dc:creator>
      <pubDate>Sun, 01 Mar 2020 01:46:10 +0000</pubDate>
      <link>https://dev.to/amritanshupandey/systemd-journald-1dcl</link>
      <guid>https://dev.to/amritanshupandey/systemd-journald-1dcl</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This article was originally published on my blog at - &lt;a href="https://blog.amritanshu.in/posts/systemd-journald/"&gt;https://blog.amritanshu.in/posts/systemd-journald/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;journald&lt;/code&gt; is a part of the &lt;code&gt;systemd&lt;/code&gt; suite of softwares that provide variety of system components for Linux based&lt;br&gt;
operating systems. journald is a daemon responsible for recording logs generated by Linux kernel and other&lt;br&gt;
applications installed on the system.&lt;/p&gt;

&lt;p&gt;Since its inception and later mass adoption by majority of the Linux distributions, systemd has remained a&lt;br&gt;
controversial topic among the Linux enthusiasts and sysadmins. Now there are both valid and not-so-sound arguments&lt;br&gt;
against systemd; but the fact that almost every major Linux distribution today uses systemd speaks for its merit&lt;br&gt;
and is a reason good enough for us to understand it better.&lt;/p&gt;

&lt;p&gt;I for one quite like the convenience and coherent ecosystem of utilities and commands that systemd provides and&lt;br&gt;
in this series of web posts I want to share some of the systemd related tid-bits and the use-cases I solve using&lt;br&gt;
systemd utilities.&lt;/p&gt;

&lt;p&gt;This first post is about the log collection and management utility provided by the systemd i.e. &lt;code&gt;systemd-journald&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is &lt;code&gt;systemd-journald&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;systemd-journald&lt;/code&gt; is a daemon to collect event logs into its data store in binary format. This daemon can be&lt;br&gt;
configured by modifying the configuration file that by default is stored at &lt;code&gt;/etc/systemd/journald.conf&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Configuration files for all systemd daemons (including journald) are in &lt;code&gt;INI&lt;/code&gt; format and are stored under&lt;br&gt;
&lt;code&gt;/etc/systemd/&lt;/code&gt;. After modifying the &lt;code&gt;INI&lt;/code&gt; files it is necessary to restart the corresponding daemon using &lt;code&gt;systemctl&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  How to restart journald
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl restart systemd-journald
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Detailed reference for the journald config can be found at the freedesktop website here - &lt;a href="https://www.freedesktop.org/software/systemd/man/journald.conf.html#"&gt;https://www.freedesktop.org/software/systemd/man/journald.conf.html#&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Few facts about the journal daemon and its config that stand out for me are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;journald can be configured to store the logs in either the persistent file system under the default path of&lt;br&gt;
&lt;code&gt;/var/log/journal/&lt;/code&gt; or in a volatile file system under  &lt;code&gt;/run/log/journal&lt;/code&gt; by default. Logs stored in the&lt;br&gt;
persistent file system are stored permanently depending upon the retention factors specified in config like total&lt;br&gt;
size, age etc. Logs stored in the volatile file system also obey similar retention logic, but are removed upon&lt;br&gt;
reboot.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;journald can be configured to forward the logs to syslog. This the default behavior for most Linux distributions.&lt;br&gt;
For e.g. in fedora journald logs are also stored in syslog format in plain text in various files under &lt;code&gt;/var/log&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo tail&lt;/span&gt; &lt;span class="nt"&gt;-3&lt;/span&gt; /var/log/messages

   Feb 28 11:49:03 xpsws NetworkManager[773]: &amp;lt;info&amp;gt;  &lt;span class="o"&gt;[&lt;/span&gt;1582850943.6441]
   Feb 28 11:49:03 xpsws systemd[1]: Starting Network Manager
   Feb 28 11:49:03 xpsws systemd[1]: Started Network Manager
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What is &lt;code&gt;journalctl&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Journalctl is a command line interface to query the logs stored by journald in its binary store.&lt;/p&gt;

&lt;p&gt;When invoked without any parameters, it displays all the logs in default syslog format. Following are a few more&lt;br&gt;
examples of the common journalctl commands that highlight its powerful features.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common commands
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;To follow all the logs on stdout (analogous to &lt;code&gt;tail -f /var/log/syslog&lt;/code&gt;)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;journalctl &lt;span class="nt"&gt;-f&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To display logs pertaining to a service (systemd unit) and display only last 12 log entries
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; &amp;lt;servicename&amp;gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To display logs in a different format e.g. &lt;code&gt;json&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; &amp;lt;servicename&amp;gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 2 &lt;span class="nt"&gt;-o&lt;/span&gt; json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notable supported formats: json, json-pretty, short, short-iso, verbose&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To display the amount of disk used by journald logs
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;journalctl &lt;span class="nt"&gt;--disk-usage&lt;/span&gt;

Archived and active journals take up 24.0M &lt;span class="k"&gt;in &lt;/span&gt;the file system.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A detailed reference guide for the journalctl cli can be found here - &lt;a href="https://www.freedesktop.org/software/systemd/man/journalctl.html"&gt;https://www.freedesktop.org/software/systemd/man/journalctl.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sysemd</category>
      <category>linux</category>
      <category>journald</category>
      <category>jouralctl</category>
    </item>
  </channel>
</rss>
