<?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 Re: Sample C++ Boost code to send msg to Splunk in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Sample-C-Boost-code-to-send-msg-to-Splunk/m-p/675629#M113050</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/264346"&gt;@dilipkha&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Under the hood, Boost calls getaddrinfo on Linux, which should accept IP addresses as strings.&lt;/P&gt;&lt;P&gt;When I compile the example with g++ 8.5.0 and Boost 1.66.0 on my RHEL 8 host, the program works as expected using http as the service:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;$ g++ -o sync_client -lboost_system -lpthread sync_client.cpp
$ chmod 0775 sync_client
$ host httpbin.org
httpbin.org has address 23.22.173.247
httpbin.org has address 52.206.0.51
$ ./sync_client 23.22.173.247 /get
Date: Sun, 28 Jan 2024 04:47:22 GMT
Content-Type: application/json
Content-Length: 225
Connection: close
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true

{
  "args": {},
  "headers": {
    "Accept": "*/*",
    "Host": "23.22.173.247",
    "X-Amzn-Trace-Id": "Root=1-65b5dc5a-2e13219829bcecc360851dcb"
  },
  "origin": "x.x.x.x",
  "url": "http://23.22.173.247/get"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your implementation, you may need to use a different query constructor on line 35, e.g.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;tcp::resolver::query query(argv[1], "8089", boost::asio::ip::resolver_query_base::numeric_host | boost::asio::ip::resolver_query_base::numeric_service);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that I've also replaced "http" with "8089" to use the default Splunk management port. On most systems, the http service resolves to port 80. See e.g. /etc/services.&lt;/P&gt;</description>
    <pubDate>Sun, 28 Jan 2024 05:07:47 GMT</pubDate>
    <dc:creator>tscroggins</dc:creator>
    <dc:date>2024-01-28T05:07:47Z</dc:date>
    <item>
      <title>Sample C++ Boost code to send msg to Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Sample-C-Boost-code-to-send-msg-to-Splunk/m-p/675423#M113035</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to run this below sample code to send msg to Splunk, but getting error - Host not found.&lt;/P&gt;&lt;P&gt;Am I doing right?&lt;/P&gt;&lt;P&gt;I'm able to ping the splunk server (171.134.154.114) from my dev Linux server.&lt;/P&gt;&lt;P&gt;However, I'm able to use Curl command successfully and able to see my msg in Splunk dashboard.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/example/http/client/sync_client.cpp" target="_blank" rel="noopener"&gt;doc/html/boost_asio/example/http/client/sync_client.cpp - 1.47.0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;./sync_client 171.134.154.114 /services/collector&lt;BR /&gt;arg[1]:171.134.154.114&lt;BR /&gt;Exception: resolve: Host not found (authoritative) [asio.netdb:1]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 17:30:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Sample-C-Boost-code-to-send-msg-to-Splunk/m-p/675423#M113035</guid>
      <dc:creator>dilipkha</dc:creator>
      <dc:date>2024-01-25T17:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sample C++ Boost code to send msg to Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Sample-C-Boost-code-to-send-msg-to-Splunk/m-p/675629#M113050</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/264346"&gt;@dilipkha&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Under the hood, Boost calls getaddrinfo on Linux, which should accept IP addresses as strings.&lt;/P&gt;&lt;P&gt;When I compile the example with g++ 8.5.0 and Boost 1.66.0 on my RHEL 8 host, the program works as expected using http as the service:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;$ g++ -o sync_client -lboost_system -lpthread sync_client.cpp
$ chmod 0775 sync_client
$ host httpbin.org
httpbin.org has address 23.22.173.247
httpbin.org has address 52.206.0.51
$ ./sync_client 23.22.173.247 /get
Date: Sun, 28 Jan 2024 04:47:22 GMT
Content-Type: application/json
Content-Length: 225
Connection: close
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true

{
  "args": {},
  "headers": {
    "Accept": "*/*",
    "Host": "23.22.173.247",
    "X-Amzn-Trace-Id": "Root=1-65b5dc5a-2e13219829bcecc360851dcb"
  },
  "origin": "x.x.x.x",
  "url": "http://23.22.173.247/get"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your implementation, you may need to use a different query constructor on line 35, e.g.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;tcp::resolver::query query(argv[1], "8089", boost::asio::ip::resolver_query_base::numeric_host | boost::asio::ip::resolver_query_base::numeric_service);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that I've also replaced "http" with "8089" to use the default Splunk management port. On most systems, the http service resolves to port 80. See e.g. /etc/services.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Jan 2024 05:07:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Sample-C-Boost-code-to-send-msg-to-Splunk/m-p/675629#M113050</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2024-01-28T05:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Sample C++ Boost code to send msg to Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Sample-C-Boost-code-to-send-msg-to-Splunk/m-p/675630#M113051</link>
      <description>&lt;P&gt;Also note that sync_client.cpp isn't a TLS client. It will only work with a plaintext HTTP server. Connecting to a TLS endpoint should return:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Exception: read_until: Connection reset by peer&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 28 Jan 2024 05:13:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Sample-C-Boost-code-to-send-msg-to-Splunk/m-p/675630#M113051</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2024-01-28T05:13:27Z</dc:date>
    </item>
  </channel>
</rss>

