Skip to content

Instantly share code, notes, and snippets.

@jackinf
Last active October 29, 2019 12:07
Show Gist options
  • Save jackinf/fafb98064fd5d14712f0826aa518de1e to your computer and use it in GitHub Desktop.
Save jackinf/fafb98064fd5d14712f0826aa518de1e to your computer and use it in GitHub Desktop.
Logging, Monitoring, Stackdriver, Seq

Seq

Running Seq instance

docker run \
  -e ACCEPT_EULA=Y \
  -v /tmp/seqdb:/data \
  -p 80:80 \
  -p 5341:5341 \
  datalust/seq:latest

In C# project, install library NLog.Targets.Seq.

Then define nlog.config something like this:

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
      autoReload="false"
      throwExceptions="true"
      internalLogLevel="Off" >
  <targets>
    <target name="seq" xsi:type="BufferingWrapper" bufferSize="1000" flushTimeout="2000">
      <target xsi:type="Seq" serverUrl="http://localhost:5341" apiKey="" />
    </target>
  </targets>

  <extensions>
    <add assembly="NLog.Targets.Seq"/>
  </extensions>

  <rules>
    <logger name="*" minlevel="Info" writeTo="seq" />
  </rules>
</nlog>

Stackdriver

To install the Stackdriver monitoring agent:

curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh
sudo bash install-monitoring-agent.sh

To install the Stackdriver logging agent:

curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh
sudo bash install-logging-agent.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment