Logs
Overview
Logs can be accessed from the web UI or through setip.io API end point.
Logs are a handy feature since they let you keep track of all DNS and Proxy activity. You can also add your app activity to the logs since you can post to the Logs from the setip.io API so you are able to view your app logs along related network components activity. This can save you time when debugging your app.
Logs view from the UI
Logs are accessible from the Logs tab.
Refresh your logs by clicking on the "Refresh" button accessible at the top of the log result component, under the Log tab.
You can search the logs on the server first by adding a search term in the "Server filter" box:
Searching logs on the filter first will return only the lines matching the search. This option is often faster but you will miss the log lines that maybe between the lines containing the search terms.
The server search box supports the following options:
- Add the
-
character before a word to exclude it from the search, as in-DNS
which will return all log lines not containing the wordDNS
. - Add multiple search terms separated by space or any punctuation to search for log lines with any of the search terms (
PROXY DNS
in the search box will lead to any log lines containing any of the words searched:PROXY
orDNS
).
To search the result returned by the server locally: enter the search term under the "search" box at the top of the log result component on the screen.
You can resize the log viewer by dragging its sides and switch to full screen mode by clicking on the full screen icon on the top right of the log lines (Only on desktops).
Logs retrieval from the API
API Spec: Logs retrieval from the API
GET
/api/log
(Fetch log entries)
URL Parameters
name type data type description max optional integer Limit the number of log lines returned with the max=[max_number_here]
query parameter, somax=4000
will returned the last 4000 lines of logs.pwd required string this is your domain name (yourproject.wg0.io) k required string Your log API key search optional string An optional search term only optional string Only search for your app related log lines, add the only
parameter with the value you used when posting to logs associated with your app (read paragraph below to learn how to post your own app logs)
Responses
http code content-type response 200
text/plain;charset=UTF-8
Log lines if any]
403
application/json
{}
Example cURL
curl "https://setip.io/api/log?pwd=yourproject.wg0.io&k=dssdc&search&max=200"
Adding to the logs
To post a log entry of your own to your logs: Use the following POST
command to the https://setip.io/api
endpoint: /logs
.
Since your own apps log lines are displayed within the system services log lines it then becomes much easier to trace activity end to end and proceed to full introspection including over the network.
API Spec: Using the API to add to the Logs
POST
/api/log
(Adds searchable log entry)
Parameter
name type data type description key required string This is your API Key payload required JSON see "JSON Value for "payload" parameter" below
JSON fields for the "payload" value
The json to post is as follow:
{
"key": "[log key accessible under the Keys tab]",
"pwd": "[The domain you wish to log to]",
"payload":
{
"message": "[any string to be searched by later]",
"meta": {
"[anyname]":"[anyvalue]",
},
"profile": "YOUR_APP_SHORT_CODE"
}
}
name type data type description pwd required string This is your domain name such as yourproject.wg0.io
message required string The message you want to log profile required string The profile
is any string of character that we recommend you keep short and in upper case so it's easy to find out what app the log line originates from, this will display where you seePROXY
andDNS
on your PoC log linesmeta optional object (JSON) You can add a meta
json value to the log entry to contain a valid json entry of any kind. This can be handy when tracing your code as you will be able to use any of these values in the future to process your logs accordingly
Responses
http code content-type response 201
text/plain;charset=UTF-8
Log created successfully
400
application/json
{"code":"400","message":"Bad Request"}
Example cURL
curl -X "POST" "https://setip.io/api/log?pwd=YOUR_DOMAIN_NAME_HERE&> k=YOUR_LOG_KEY_HERE&search&max=200" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"payload": {
"message": "This text will display in the logs as the log line entry",
"meta": {
"nynewobject": {
"newobjectownfield": "atextvaluefornewobjectownfield"
},
"mynewfield": "avalueformynewfield"
}
}
}'