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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...