<?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 Splunk Logging Libraries for .NET: Is there a C# sample code for HTTP Event Collector that works with Splunk Cloud? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-Logging-Libraries-for-NET-Is-there-a-C-sample-code-for/m-p/261403#M50171</link>
    <description>&lt;P&gt;Splunk Logging Libraries for .NET: &lt;A href="http://dev.splunk.com/view/splunk-loglib-dotnet/SP-CAAAEX4"&gt;http://dev.splunk.com/view/splunk-loglib-dotnet/SP-CAAAEX4&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Most of the samples and articles on this website tells about hosted version of Splunk Enterprise.  These code samples does not work with Splunk Cloud. Could anyone post a C# sample code for HTTP Event Collector that really works with Splunk Cloud?&lt;/P&gt;</description>
    <pubDate>Fri, 02 Dec 2016 17:44:45 GMT</pubDate>
    <dc:creator>maqsoodbhatti</dc:creator>
    <dc:date>2016-12-02T17:44:45Z</dc:date>
    <item>
      <title>Splunk Logging Libraries for .NET: Is there a C# sample code for HTTP Event Collector that works with Splunk Cloud?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-Logging-Libraries-for-NET-Is-there-a-C-sample-code-for/m-p/261403#M50171</link>
      <description>&lt;P&gt;Splunk Logging Libraries for .NET: &lt;A href="http://dev.splunk.com/view/splunk-loglib-dotnet/SP-CAAAEX4"&gt;http://dev.splunk.com/view/splunk-loglib-dotnet/SP-CAAAEX4&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Most of the samples and articles on this website tells about hosted version of Splunk Enterprise.  These code samples does not work with Splunk Cloud. Could anyone post a C# sample code for HTTP Event Collector that really works with Splunk Cloud?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 17:44:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-Logging-Libraries-for-NET-Is-there-a-C-sample-code-for/m-p/261403#M50171</guid>
      <dc:creator>maqsoodbhatti</dc:creator>
      <dc:date>2016-12-02T17:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Logging Libraries for .NET: Is there a C# sample code for HTTP Event Collector that works with Splunk Cloud?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-Logging-Libraries-for-NET-Is-there-a-C-sample-code-for/m-p/261404#M50172</link>
      <description>&lt;P&gt;Just sniffed what httpEventCollector .NET logging library is doing, I can see its posting following _Json object;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"time":"1480703033,509","event":{"id":"0","severity":"Information","message":"WannaBeCloudLoggingSystem"}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This would not work, since its missing  index values;&lt;/P&gt;

&lt;P&gt;How to set Index within c# Code?&lt;/P&gt;

&lt;P&gt;Here is my Code;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        var traceSource = new TraceSource("MyConsoleApp");
        traceSource.Switch.Level = SourceLevels.All;
        traceSource.Listeners.Clear();


        var myListener = new HttpEventCollectorTraceListener(
    uri: new Uri("https://http-inputs-crapcloudlogger.splunkcloud.com/services/collector/event"),
    token: "T O K E N");

        myListener.AddLoggingFailureHandler((HttpEventCollectorException e) =&amp;gt; {
                Console.WriteLine("{0}", e);
            });

        try
            {
                traceSource.Listeners.Add(myListener);
            }
            catch(Exception ex)
            { Console.WriteLine("{0}", ex);
            }

        traceSource.TraceEvent(TraceEventType.Information,0,"WannaBeCloudLoggingSystem");
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Dec 2016 18:28:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-Logging-Libraries-for-NET-Is-there-a-C-sample-code-for/m-p/261404#M50172</guid>
      <dc:creator>maqsoodbhatti</dc:creator>
      <dc:date>2016-12-02T18:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Logging Libraries for .NET: Is there a C# sample code for HTTP Event Collector that works with Splunk Cloud?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-Logging-Libraries-for-NET-Is-there-a-C-sample-code-for/m-p/261405#M50173</link>
      <description>&lt;P&gt;I would answer my question self: &lt;/P&gt;

&lt;P&gt;Here is the way to create a Metadata for for index:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var meta = new HttpEventCollectorEventInfo.Metadata(index: "loggly", source: "microservice1", sourceType: "_json", host: "numb");
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but the challenge i guess is not the INDEX, but the time format, If I remove values after commma in the time then it works, &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"time":"1480703033","event":{"id":"0","severity":"Information","message":"WannaBeCloudLoggingSystem"}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but why does Splunk Cloud not accept its own time format as described here?&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/event-collector/SP-CAAAE6P"&gt;http://dev.splunk.com/view/event-collector/SP-CAAAE6P&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2016 16:52:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-Logging-Libraries-for-NET-Is-there-a-C-sample-code-for/m-p/261405#M50173</guid>
      <dc:creator>maqsoodbhatti</dc:creator>
      <dc:date>2016-12-03T16:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Logging Libraries for .NET: Is there a C# sample code for HTTP Event Collector that works with Splunk Cloud?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-Logging-Libraries-for-NET-Is-there-a-C-sample-code-for/m-p/261406#M50174</link>
      <description>&lt;P&gt;Okay I figured it out. The default timestamp has "," in the it and this is not according jSON datetime format. changed  my console app default culture, and it worked.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 03 Dec 2016 17:25:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-Logging-Libraries-for-NET-Is-there-a-C-sample-code-for/m-p/261406#M50174</guid>
      <dc:creator>maqsoodbhatti</dc:creator>
      <dc:date>2016-12-03T17:25:26Z</dc:date>
    </item>
  </channel>
</rss>

