Forum Discussion

alex_panganiban's avatar
alex_panganiban
Contributor
4 years ago

Splunk Logging Using REST Post

I am attempting to create Splunk logs using a REST Post snap. I am successful when using a curl command, however, I want to transpose this into a Snaplogic solution. When I try to use Postman, I get the same error that I get with Snaplogic. Please help.





2 Replies

    • GBekkanti's avatar
      GBekkanti
      New Contributor III

      Sorry for my wrong input structure. the below is the correct one. It is a list of objects rather than 3 single objects

      {‘items’:[
      {
      ‘ID’:123,
      ‘Name’:‘Tony’,
      ‘Age’:24
      },
      {
      ‘ID’:124,
      ‘Name’:‘Sam’,
      ‘Age’:36
      },
      {
      ‘ID’:125,
      ‘Name’:‘Glenn’,
      ‘Age’:58
      }]}

      and the view in mapper is like below:

      Can you please process now?

      • tstack's avatar
        tstack
        Former Employee

        Since you’re manipulating an array, you’ll want to look into the “Mapping Root” feature of the Mapper. By pointing the Mapping Root at your array, the Transformations will be applied to the elements of the array instead of the top-level document. Otherwise, the Mapper configuration is the same as suggested by @christwr:

  • @GBekkanti

    sounds like you want to do something like this which you can do using sl.zip()

    sl.zip($items, $genderArray).map(pair => pair[0].extend({ Gender: pair[1] }))