<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Set logging levels with splunk sdk in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145887#M2019</link>
    <description>&lt;P&gt;So that example is using a &lt;A href="https://github.com/flatiron/winston/"&gt;Winston logging&lt;/A&gt; transport (winston-loggly)&lt;/P&gt;

&lt;P&gt;One of our community developers wrote a &lt;A href="https://github.com/erichelgeson/winston-splunk"&gt;Splunk transport for Winston&lt;/A&gt; (winston-splunk).&lt;/P&gt;

&lt;P&gt;There are many other Winston logging transports available that you could also use for Splunk.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Feb 2014 20:11:33 GMT</pubDate>
    <dc:creator>Damien_Dallimor</dc:creator>
    <dc:date>2014-02-11T20:11:33Z</dc:date>
    <item>
      <title>Set logging levels with splunk sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145886#M2018</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;

&lt;P&gt;I am evaluating splunk-sdk for node. My application throws up a lot of messages, some info, some warn, some error. I have a requirement to log specific error levels only and the level is determined via a cmd line argument&lt;/P&gt;

&lt;P&gt;e.g with Loggly I would do something like this. With the code below loggly only logs errors and ignores other types of messages.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;node app.js error

// create loggly transport
var error_level = process.argv[2]; 
var logglyTransport = new (winston.transports.Loggly)({
   subdomain: xxxx,
   inputToken: xxxxx,
   auth: xxxx,
   json: true,
   level: error_level
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do we achieve the same with splunk-sdk?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2014 12:53:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145886#M2018</guid>
      <dc:creator>girishbr</dc:creator>
      <dc:date>2014-02-11T12:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: Set logging levels with splunk sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145887#M2019</link>
      <description>&lt;P&gt;So that example is using a &lt;A href="https://github.com/flatiron/winston/"&gt;Winston logging&lt;/A&gt; transport (winston-loggly)&lt;/P&gt;

&lt;P&gt;One of our community developers wrote a &lt;A href="https://github.com/erichelgeson/winston-splunk"&gt;Splunk transport for Winston&lt;/A&gt; (winston-splunk).&lt;/P&gt;

&lt;P&gt;There are many other Winston logging transports available that you could also use for Splunk.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2014 20:11:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145887#M2019</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2014-02-11T20:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: Set logging levels with splunk sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145888#M2020</link>
      <description>&lt;P&gt;Hi @grishbr&lt;/P&gt;

&lt;P&gt;We support different log levels in the SDK. To set the level you use the LOG_LEVEL environment variable.&lt;/P&gt;

&lt;P&gt;You can set the levels to one of the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var levels = {
    "ALL": 4,
    "INFO": 3,
    "WARN": 2,
    "ERROR": 1,
    "NONE": 0
};
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;so for example you could set &lt;CODE&gt;process.env.LOG_LEVEL = 3&lt;/CODE&gt; in your JS code to choose just INFO, or you could just set the environment variable before you app executes.&lt;/P&gt;

&lt;P&gt;In case you are interested, the code where this is implemented is here: &lt;A href="https://github.com/splunk/splunk-sdk-javascript/blob/master/lib/log.js#L34"&gt;https://github.com/splunk/splunk-sdk-javascript/blob/master/lib/log.js#L34&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Let us know if this works for you and thanks for using our SDK!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2014 21:35:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145888#M2020</guid>
      <dc:creator>gblock_splunk</dc:creator>
      <dc:date>2014-02-11T21:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Set logging levels with splunk sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145889#M2021</link>
      <description>&lt;P&gt;I set process.env.LOG_LEVEL = 1 hoping to log only "ERROR" but that doesn't seem to work. It just logs everything.&lt;/P&gt;

&lt;P&gt;I tried setting it with splunkjs.Logger.setLevel(1)  -&amp;gt; no luck either&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2014 04:31:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145889#M2021</guid>
      <dc:creator>girishbr</dc:creator>
      <dc:date>2014-02-12T04:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Set logging levels with splunk sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145890#M2022</link>
      <description>&lt;P&gt;I started with this. But I couldnt seem to get the log level working. So I moved on to the officially endorsed splunk-sdk&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2014 04:32:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145890#M2022</guid>
      <dc:creator>girishbr</dc:creator>
      <dc:date>2014-02-12T04:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Set logging levels with splunk sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145891#M2023</link>
      <description>&lt;P&gt;I am quite sure I am missing something trivial. Can you pls take a look at my gist?&lt;BR /&gt;
Have two js files: app.js requires splunkSdkLogger.js&lt;/P&gt;

&lt;P&gt;&lt;A href="https://gist.github.com/techmechie/12d59a117d2db94d5901"&gt;https://gist.github.com/techmechie/12d59a117d2db94d5901&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2014 16:56:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145891#M2023</guid>
      <dc:creator>girishbr</dc:creator>
      <dc:date>2014-02-12T16:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Set logging levels with splunk sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145892#M2024</link>
      <description>&lt;P&gt;Hi @grishbr, I've looked at the code now. I think you are expecting the log levels to work differently than they are designed for. In the example you are setting the log level and then calling methods on the logger which are then sending log messages to Splunk using different log levels. It sounds like you are expecting to see that you would only see console output for the "error" events you sent. Is that correct?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2014 19:50:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145892#M2024</guid>
      <dc:creator>gblock_splunk</dc:creator>
      <dc:date>2014-02-12T19:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Set logging levels with splunk sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145893#M2025</link>
      <description>&lt;P&gt;(cont)&lt;/P&gt;

&lt;P&gt;The log level in the SDK does not correspond to events / data you send to Splunk. The level tells us how much information we should return to you as a user of the SDK. This data could either relate to information we generate within the SDK code, OR could correspond to results from the server. For example if the server sends back a response that contains messages, then we will filter those levels based on the log level setting.&lt;/P&gt;

&lt;P&gt;Does that clarify?&lt;/P&gt;

&lt;P&gt;As a side note you can easily use the LOG_LEVEL env variable in your own code so that only the selected level or above is outputted.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2014 19:50:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145893#M2025</guid>
      <dc:creator>gblock_splunk</dc:creator>
      <dc:date>2014-02-12T19:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Set logging levels with splunk sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145894#M2026</link>
      <description>&lt;P&gt;Thanks a lot! I now understand this whole thing pretty well. My code is now running fine &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2014 16:07:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145894#M2026</guid>
      <dc:creator>girishbr</dc:creator>
      <dc:date>2014-02-13T16:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Set logging levels with splunk sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145895#M2027</link>
      <description>&lt;P&gt;@grishbr great, glad to help!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2014 21:23:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Set-logging-levels-with-splunk-sdk/m-p/145895#M2027</guid>
      <dc:creator>gblock_splunk</dc:creator>
      <dc:date>2014-02-13T21:23:29Z</dc:date>
    </item>
  </channel>
</rss>

