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!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...