How to include a log with origin IP information at log files?

8 views
Skip to first unread message

Diego sanches pereira

unread,
Feb 27, 2024, 9:53:14 AM2/27/24
to mountebank-discuss
Hello everyone, exist an way to get some kind of custom log from with the information that includes who is calling the imposter so I will be able to trace the origin of the request and can have a better analysis from the data.

as you can see I just have those kind on information at DEBUG mode:

warn: [mb:8080] Running with --allowInjection set. See http://localhost:8080/docs/security for security info
info: [mb:8080] mountebank v2.8.2 now taking orders - point your browser to http://localhost:8080/ for help
info: [mb:8080] PUT /imposters
debug: [mb:8080] ::ffff:127.0.0.1:20074 => {"imposters":[{"protocol":"http","port":8443,"name":"cadastr","defaultResponse":{"headers":{"Content-Type":"application/json"},"body":"Chamada não reconhecida pelo rebatedor de cadastro. Documentação:"},"recordRequests":true,"stubs":[{"predicates":[{"and":[{"equals":{"method":"POST","path":"/propost1/bkpara"}}]}],"responses":[{"is":{"statusCode":200,"body":"{ \"id\":${id},\"description\": \"${description}\"}"},"behaviors":[{"copy":{"from":"body","into":"${description}","using":{"method":"jsonpath","selector":"$.description"}}},{"copy":{"from":"body","into":"${id}","using":{"method":"jsonpath","selector":"$.id"}}}]}]},{"predicates":[{"and":[{"equals":{"method":"GET","path":"/propost1/bkpara"}}]}],"responses":[{"is":{"statusCode":200,"body":[{"id":1,"description":"data1"},{"id":2,"description":"state"},{"id":3,"description":"stateInscription"},{"id":4,"description":"stat"},{"id":5,"description":"bk1"},{"id":6,"description":"agency"},{"id":7,"description":"user"},{"id":8,"description":"ownerBirthDate1"},{"id":9,"description":"ownerBirthDate2"},{"id":10,"description":"ownerBirthDate3"},{"id":11,"description":"personType"},{"id":12,"description":"lineOf"},{"id":13,"description":"capt"},{"id":14,"description":"plan"},{"id":15,"description":"data22"},{"id":16,"description":"data22Establishment"},{"id":17,"description":"typeee"},{"id":22,"description":"paramTest2"}]}}]},{"predicates":[{"and":[{"equals":{"method":"POST"}},{"matches":{"path":"/propost1/bkpara/\\d*/delete"}}]}],"responses":[{"is":{"statusCode":200,"body":{}}}]},{"predicates":[{"and":[{"equals":{"method":"POST","path":"/propost1/proAAA/e"}}]}],"responses":[{"is":{"statusCode":200,"body":"{\n    \"id\": \"${id}\",\n    \"email\": \"${email}\",\n    \"category\": \"${category}\"\n}"},"behaviors":[{"decorate":"(config) => {const randomNumber = Math.floor(Math.random() * 9999999999) + 1;console.log(randomNumber);config.response.body = config.response.body.replace('${id}', randomNumber);}"},{"copy":{"from":"body","into":"${email}","using":{"method":"jsonpath","selector":"$.email"}}},{"copy":{"from":"body","into":"${category}","using":{"method":"jsonpath","selector":"$.category"}}}]}]},{"predicates":[{"and":[{"equals":{"method":"POST"}},{"matches":{"path":"/propost1/proAAA/e/\\d*/delete"}}]}],"responses":[{"is":{"statusCode":200,"body":{}}}]},{"predicates":[{"and":[{"equals":{"method":"GET"}},{"matches":{"path":"/propost1/proAAA/e/\\d.*"}}]}],"responses":[{"is":{"statusCode":200,"body":"{ \"id\":$id,\"email\": \"${email}\",    \"category\": \"${category}\"


I appreciate all you help!
Thanks in advance 
Reply all
Reply to author
Forward
0 new messages