[quote="kish, post:14, topic:135332"]

reg

[/quote]

I understand that you were asking what is the data sent from client to the program. I will try to explain in the logs itself.

Full code from the point program receive from client to till store the data

> func Register(w http.ResponseWriter, req *http.Request, vars map[string]string) {

> log.Println("-> register")

> defer log.Println("<- register")

>

> var reg RegisterInfo

> err := json.Unmarshal([]byte(vars["Body"]), ®)

> w.Header().Set("Content-Type", "application/json; charset=UTF-8")

> if err != nil {

> w.WriteHeader(http.StatusBadRequest)

> log.Println("Json unmarshalling failed:  ", err.Error())

> writeError(w, "Json unmarshalling failed: "+err.Error())

> return

> }

> if reg.Address == "" || reg.Uuid == "" || reg.NodeType == "" {

> log.Println("Missing fields in register input - ", reg)

> w.WriteHeader(http.StatusBadRequest)

> writeError(w, "Missing fields in register input, "+err.Error())

> return

> }

> **log.Println("register info---->", reg)**

> err = saveRegisterInfo(reg)

> if err == nil {

> w.WriteHeader(http.StatusOK)

> writeSucces(w, "Registered")

> } else {

> w.WriteHeader(http.StatusInternalServerError)

> log.Println("Failed to save register info, " + err.Error())

> writeError(w, "Failed to save register info, "+err.Error())

> }

> // TODO: handle already registered case

> }

> func saveRegisterInfo(reg RegisterInfo) (err error) {

> **log.Println("reg-info ->", reg)**

> if !registerExists(reg) {

> put1, err := elasticSearchClient.Index().

> Index(RegisterIndex).

> Type(RegisterDocType).

> BodyJson(reg).

> Do(elasticSearchContext)

> if err != nil {

> log.Println("Failed to store register entry, ", err.Error())

> return err

> }

> log.Println("Indexed", put1.Id, "to index", put1.Index, "type \n", put1.Type)

> doc, err := elasticSearchClient.Get().Index(put1.Index).Type(put1.Type).Id(put1.Id).Do(elasticSearchContext)

> if err != nil {

> log.Println("testing log ->", err)

> }

> log.Println("testing log err -> ", err)

> log.Println("testing log doc -> ", doc)

> } else {

> log.Println("Registration exists, skipped")

> // TODO: check and remove multiple records and store new one.

> }

> return err

> }

Logs below

> 2018/06/14 15:18:16 --> Entering

> 2018/06/14 15:18:16 Request received:  POST /api/register Register 2018-06-14 15:18:16.761873558 +0530 IST

> 2018/06/14 15:18:16 --> Entering

> 2018/06/14 15:18:16 Vars received  map[]

> 2018/06/14 15:18:16 No form elements in request

> 2018/06/14 15:18:16 <-- Returning

> 2018/06/14 15:18:16 --> Entering

> 2018/06/14 15:18:16 <-- Returning

> 2018/06/14 15:18:16 Authentication Failed: Credentials not set

> 2018/06/14 15:18:16 -> register

> 2018/06/14 15:18:16 **register info**----> {lavnf-cscf01 Dw1hO5S3 cscf 3a00::10}  -> **this is the data received from client**

> 2018/06/14 15:18:16 **reg-info** -> {lavnf-cscf01 Dw1hO5S3 cscf 3a00::10}   -> **this is the data inside the saveRegisterInfo fucn**

> 2018/06/14 15:18:16 Indexed AWP9shX9lX2VvIMTDcEO to index register type

>  register

> 2018/06/14 15:18:16 testing log err ->  <nil>

> 2018/06/14 15:18:16 testing log doc ->  &{register register AWP9shX9lX2VvIMTDcEO    0xc4205f7f50 0xc4206432a0 true map[] <nil>}

> 2018/06/14 15:18:16 <- register

> 2018/06/14 15:18:16 Request completed: POST /api/register Register 16.27µs

> 2018/06/14 15:18:16 <-- Returning

The same program works for ipv4 i.e if the reg is {lavnf-cscf01 Dw1hO5S3 cscf  1.2.3.4}

---

NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB