Getting Data In

How to set the Metadata field using the Splunk .Net logging library HttpEventCollectorSender?

sfortier99
Engager

I'm using the Splunk .Net logging library on Github to interface to the Splunk HTTP Event Collector.

My question is, how to set the Metadata field using the following example:

        var ecSender = new HttpEventCollectorSender(new Uri("https://localhost:8088"),
            "AAAAAAAAAAAAAAAAAAAAAAA",
            how to set this Metadata field - I want it to be source="AppA",
            HttpEventCollectorSender.SendMode.Sequential,
            0,
            0,
            0,
            middleware.Plugin
        );

Thanks.

0 Karma
1 Solution

somesoni2
Revered Legend

Before invoking this HttpEventCollectorSender constructor, create an object of type HttpEventCollectorEventInfo and set it's Metadata property. Details of HttpEventCollectorEventInfo class here.

https://github.com/splunk/splunk-library-dotnetlogging/blob/3ca85b1e51082d8c0dfe9815c1006e252656efae...

The Metadata is a nested class within HttpEventCollectorEventInfo class with following attributes

            public string Index { get; private set; }
            public string Source { get; private set; }
            public string SourceType { get; private set; }
            public string Host { get; private set; }

View solution in original post

somesoni2
Revered Legend

Before invoking this HttpEventCollectorSender constructor, create an object of type HttpEventCollectorEventInfo and set it's Metadata property. Details of HttpEventCollectorEventInfo class here.

https://github.com/splunk/splunk-library-dotnetlogging/blob/3ca85b1e51082d8c0dfe9815c1006e252656efae...

The Metadata is a nested class within HttpEventCollectorEventInfo class with following attributes

            public string Index { get; private set; }
            public string Source { get; private set; }
            public string SourceType { get; private set; }
            public string Host { get; private set; }

maqsoodbhatti
Explorer

MetaData property are read-only says it when i try to initialize, Could you share code please?

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...