Getting Data In

Help with source code for logging in Splunk Cloud

venkatesanengin
New Member

I am trying to post logs onto Splunk cloud from .NET application.
Below is the source code, please let me know if am missing something:

public bool SendDataToSplunk()
        {
            var middleware = new HttpEventCollectorResendMiddleware(100);
            var ecSender = new HttpEventCollectorSender(new Uri("https://prd-p-pqh9ws5tppvf.cloud.splunk.com"),  //http port as set in global setting
                "c5731f11-dd2b-4261-ac68-7292d1bcb6a4",  // token
                null,
                HttpEventCollectorSender.SendMode.Sequential,
                0,
                0,
                0,
                middleware.Plugin
            );
            ecSender.OnError += o => Console.WriteLine(o.Message);
            ecSender.Send(Guid.NewGuid().ToString(), "INFO", null, new { Foo = "Vihaan" });
            ecSender.FlushSync();

            return true;
        }
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...

Operationalizing TDIR: Building a More Resilient, Scalable SOC

Optimizing SOC workflows with a unified, risk-based approach to Threat Detection, Investigation, and Response ...