<p>Does anyone know how to configure Promtail to watch and tail custom log paths in a Kubernetes pod? I have a deployment that creates customized log files in a directory like so <code>/var/log/myapp</code>. I found some documentation <a href="https://github.com/jafernandez73/grafana-loki/blob/master/docs/promtail-setup.md" rel="nofollow noreferrer">here</a> that says to deploy Promtail as a sidecar to the container you want to collect logs from. I was hoping someone could explain how this method works in practice. Does it need to be done as a sidecar or could it be done as a Daemonset? Or if you have alternative solution that has proven to work could please show me an example.</p>

<p>Posting comment as the community wiki answer for better visibility:</p>
<hr />
<p><em>Below information is taken from README.md from the GitHun repo provided by atlee19:</em></p>
<p><strong>This docs assume</strong>:</p>
<ul>
<li><p>you have loki and grafana already deployed. Please refered to official documentation for installation</p>
</li>
<li><p>The logfile you want to scrape is in JSON format</p>
</li>
</ul>
<p>This Helm chart deploy a application pod with 2 containers: - a Golang app writing logs in a separate file. - a Promtail that read that log file and send it to loki.</p>
<p>The file path can be updated via the <a href="https://github.com/giantswarm/simple-logger/blob/master/helm/values.yaml" rel="nofollow noreferrer">./helm/values.yaml</a> file.</p>
<p><code>sidecar.labels</code> is a map where you can add the labels that will be added to your log entry in Loki.</p>
<p>Example:</p>
<ul>
<li><code>Logfile</code> located at <code>/home/slog/creator.log</code></li>
<li>Adding labels
<ul>
<li><code>job: promtail-sidecar</code></li>
<li><code>test: golang</code></li>
</ul>
</li>
</ul>
<pre><code>sidecar:
  logfile:
    path: /home/slog
    filename: creator.log
  labels:
    job: promtail-sidecar
    test: golang
</code></pre>
