<?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 Using TCP data input to receive from switch sending data in raw format protocol buffers in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Using-TCP-data-input-to-receive-from-switch-sending-data-in-raw/m-p/425392#M94462</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;
I am trying to receive data in splunk using TCP Data input from switch at port 20010. The data is in raw format(send via grpc using protocol buffers). Splunk is receiving the data and adding to event but it  is like encrypted format in which it is being transferred.&lt;BR /&gt;
Sample below:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Blockquote&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0\x00\x00\xFF\xFF\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00%\x00\x00\x00:methodPOST@:path&amp;amp;/mdt_dialout.gRPCMdtDialout/MdtDialout@&lt;BR /&gt;
:authority:57010@&lt;BR /&gt;
grpc-encodingidentity@grpc-accept-encodingidentity,deflate,@content-typeapplication/grpc@&lt;BR /&gt;
user-agent+grpc-c++/1.0.0 grpc-c/1.0.0 (linux; )@grpc-timeout30S\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFB&lt;BR /&gt;
wIObw*9728z&amp;#16;rtIOb*3170304z&amp;#16;wtIOb*&amp;#7;3170304zrtIOint*&amp;#8;13785891zwtIOint*&amp;#6;562518*&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Blockquote&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Is it possible to run any python or any other code to get this data while it is being received and convert to json/anyother format then send to the  splunk index.&lt;/P&gt;

&lt;P&gt;I didn't find any place to include any script file which modifies the TCP received input before sending to index.&lt;BR /&gt;
Is there any way to do that?&lt;/P&gt;

&lt;P&gt;Alternative I have done is a seperate python script to receive the data from switch and parse it and send to splunk and placed the python script inside an AddOn. But I want to use the direct method that splunk receives from switch directly via TCP and parse it via some script.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 20:18:55 GMT</pubDate>
    <dc:creator>sawgata12345</dc:creator>
    <dc:date>2020-09-29T20:18:55Z</dc:date>
    <item>
      <title>Using TCP data input to receive from switch sending data in raw format protocol buffers</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-TCP-data-input-to-receive-from-switch-sending-data-in-raw/m-p/425392#M94462</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I am trying to receive data in splunk using TCP Data input from switch at port 20010. The data is in raw format(send via grpc using protocol buffers). Splunk is receiving the data and adding to event but it  is like encrypted format in which it is being transferred.&lt;BR /&gt;
Sample below:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Blockquote&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0\x00\x00\xFF\xFF\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00%\x00\x00\x00:methodPOST@:path&amp;amp;/mdt_dialout.gRPCMdtDialout/MdtDialout@&lt;BR /&gt;
:authority:57010@&lt;BR /&gt;
grpc-encodingidentity@grpc-accept-encodingidentity,deflate,@content-typeapplication/grpc@&lt;BR /&gt;
user-agent+grpc-c++/1.0.0 grpc-c/1.0.0 (linux; )@grpc-timeout30S\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFB&lt;BR /&gt;
wIObw*9728z&amp;#16;rtIOb*3170304z&amp;#16;wtIOb*&amp;#7;3170304zrtIOint*&amp;#8;13785891zwtIOint*&amp;#6;562518*&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Blockquote&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Is it possible to run any python or any other code to get this data while it is being received and convert to json/anyother format then send to the  splunk index.&lt;/P&gt;

&lt;P&gt;I didn't find any place to include any script file which modifies the TCP received input before sending to index.&lt;BR /&gt;
Is there any way to do that?&lt;/P&gt;

&lt;P&gt;Alternative I have done is a seperate python script to receive the data from switch and parse it and send to splunk and placed the python script inside an AddOn. But I want to use the direct method that splunk receives from switch directly via TCP and parse it via some script.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:18:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-TCP-data-input-to-receive-from-switch-sending-data-in-raw/m-p/425392#M94462</guid>
      <dc:creator>sawgata12345</dc:creator>
      <dc:date>2020-09-29T20:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using TCP data input to receive from switch sending data in raw format protocol buffers</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-TCP-data-input-to-receive-from-switch-sending-data-in-raw/m-p/425393#M94463</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;

&lt;P&gt;You could use &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.1.1/Data/Monitornetworkports"&gt;https://docs.splunk.com/Documentation/Splunk/7.1.1/Data/Monitornetworkports&lt;/A&gt; and then use props and transforms to modify data before indexing&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 11:50:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-TCP-data-input-to-receive-from-switch-sending-data-in-raw/m-p/425393#M94463</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-07-03T11:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using TCP data input to receive from switch sending data in raw format protocol buffers</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-TCP-data-input-to-receive-from-switch-sending-data-in-raw/m-p/425394#M94464</link>
      <description>&lt;P&gt;Hi Renjith,&lt;BR /&gt;
I have used the same link to create the TCP input but my issue was  to parse the output.&lt;BR /&gt;
I had done it in python and created a AddOn by converting the raw input into dictionary and then parsing and taking out the required fields and forming specific json and send to Splunk via sdk.&lt;BR /&gt;
I checked the prof.conf and transform.conf from the links where only option is writing regex  to parse the inputs.&lt;BR /&gt;
Here is How the input comes from switch:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Blockquote&lt;BR /&gt;
node_id_str: "switch1"&lt;BR /&gt;
encoding_path: "query:10050"&lt;BR /&gt;
collection_id: 1100&lt;BR /&gt;
msg_timestamp: 1515492081100&lt;BR /&gt;
data_gpbkv {&lt;BR /&gt;
  fields {&lt;BR /&gt;
    name: "keys"&lt;BR /&gt;
    fields {&lt;BR /&gt;
      name: "query:10050"&lt;BR /&gt;
      string_value: "query:10050"&lt;BR /&gt;
    }&lt;BR /&gt;
  }&lt;BR /&gt;
  fields {&lt;BR /&gt;
    name: "content"&lt;BR /&gt;
    fields {&lt;BR /&gt;
      fields {&lt;BR /&gt;
        name: "values"&lt;BR /&gt;
        fields {&lt;BR /&gt;
          fields {&lt;BR /&gt;
            name: "1"&lt;BR /&gt;
            fields {&lt;BR /&gt;
              fields {&lt;BR /&gt;
                name: "port"&lt;BR /&gt;
                string_value: "fc2/4"&lt;BR /&gt;
              }&lt;BR /&gt;
              fields {&lt;BR /&gt;
                name: "scsi_target_count"&lt;BR /&gt;
                string_value: "0"&lt;BR /&gt;
              }&lt;BR /&gt;
            }&lt;BR /&gt;
          }&lt;BR /&gt;
         fields {&lt;BR /&gt;
            name: "2"&lt;BR /&gt;
            fields {&lt;BR /&gt;
              fields {&lt;BR /&gt;
                name: "port"&lt;BR /&gt;
                string_value: "fc2/3"&lt;BR /&gt;
              }&lt;BR /&gt;
              fields {&lt;BR /&gt;
                name: "scsi_target_count"&lt;BR /&gt;
                string_value: "1"&lt;BR /&gt;
              }&lt;BR /&gt;
            }&lt;BR /&gt;
          }&lt;BR /&gt;
        fields {&lt;BR /&gt;
            name: '3"&lt;BR /&gt;
            fields {&lt;BR /&gt;
              fields {&lt;BR /&gt;
                name: "port"&lt;BR /&gt;
                string_value: "fc16/3"&lt;BR /&gt;
              }&lt;BR /&gt;
              fields {&lt;BR /&gt;
                name: "scsi_target_count"&lt;BR /&gt;
                string_value: "3"&lt;BR /&gt;
              }&lt;BR /&gt;
            }&lt;BR /&gt;
          }&lt;BR /&gt;
     //similarly there are details for "name":"4", "name":"5"  ... so on till "name":"40"&lt;BR /&gt;
      }&lt;BR /&gt;
      }&lt;BR /&gt;
    }&lt;BR /&gt;
  }&lt;BR /&gt;
}&lt;BR /&gt;
Blockquote&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Here i need to go through a loop and take out the values like below:&lt;BR /&gt;
&lt;EM&gt;from the output  from above code: &lt;BR /&gt;
      name: "scsi_target_count"&lt;BR /&gt;
       string_value: "3"&lt;BR /&gt;
we need to make like     "scsi_target_count":"3"&lt;/EM&gt; . like key value pair and form json as shown below to send to splunk. This i have done in python for the AddOn.  I thought to call python script from the TCP input and get the json formated output and then send to indexer.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;{"name":"1","node_id_str": "switch1","msg_timestamp": "1515492081100","port": "fc2/4","scsi_target_count":"0"}&lt;BR /&gt;
{name: "2","node_id_str": "switch1","msg_timestamp": "1515492081100","port": "fc2/3","scsi_target_count":"1"}&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;similarly more ports are there so multiple json objects with the common part for all is&lt;BR /&gt;
"node_id_str": "switch1","msg_timestamp": "1515492081100"     and the  varying part is  "port": "xx/x","scsi_target_count":"count" .&lt;/P&gt;

&lt;P&gt;Is there any way in regex in transform.conf to get similar output?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:19:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-TCP-data-input-to-receive-from-switch-sending-data-in-raw/m-p/425394#M94464</guid>
      <dc:creator>sawgata12345</dc:creator>
      <dc:date>2020-09-29T20:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using TCP data input to receive from switch sending data in raw format protocol buffers</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-TCP-data-input-to-receive-from-switch-sending-data-in-raw/m-p/425395#M94465</link>
      <description>&lt;P&gt;If you have a lot of data processing, have a look at this blog also : &lt;A href="https://www.splunk.com/blog/2014/11/11/protocol-data-inputs.html"&gt;https://www.splunk.com/blog/2014/11/11/protocol-data-inputs.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 10:00:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-TCP-data-input-to-receive-from-switch-sending-data-in-raw/m-p/425395#M94465</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-07-05T10:00:00Z</dc:date>
    </item>
  </channel>
</rss>

