{"_id":"58ebfb0e7409060f0048f3c8","version":{"_id":"56ba46e2ce5d540d00e2d7aa","project":"56ba46e2ce5d540d00e2d7a7","__v":12,"createdAt":"2016-02-09T20:06:58.727Z","releaseDate":"2016-02-09T20:06:58.727Z","categories":["56ba46e3ce5d540d00e2d7ab","5771a6b145c7080e0072927f","5771a72eb0ea6b0e006a5221","5772e5b20a6d610e00dea073","577c3006b20f211700593629","57ae587bca3e310e00538155","57ae593a7c93fa0e001e6b50","57b1f8263ff6c519005cf074","582601f155b1060f00ec4173","582a62857a96051b0070b011","58ebfae58d5a860f00851fb9","590a75a1ec0d5e190095ab38"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":4,"project":"56ba46e2ce5d540d00e2d7a7","parentDoc":null,"category":{"_id":"58ebfae58d5a860f00851fb9","__v":0,"project":"56ba46e2ce5d540d00e2d7a7","version":"56ba46e2ce5d540d00e2d7aa","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-04-10T21:36:37.961Z","from_sync":false,"order":6,"slug":"public-api","title":"Public API"},"user":"56ba5416b77e261700bc14b1","updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-04-10T21:37:18.131Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"method":"get","results":{"codes":[{"name":null,"code":"{\"_logtype\":\"syslogline\",\"_ingester\":\"agent\",\"_ip\":\"40.121.203.183\",\"pid\":5573,\"program\":\"docker\",\"_host\":\"k8s-master-5A226838-0\",\"logsource\":\"k8s-master-5A226838-0\",\"_app\":\"syslog\",\"_file\":\"/var/log/syslog\",\"_line\":\"docker[5573]: I0411 00:18:39.644199    6124 conversion.go:134] failed to handle multiple devices for container. Skipping Filesystem stats\",\"_ts\":1491869920198,\"timestamp\":\"2017-04-11T00:18:39.000Z\",\"_id\":\"804760774821019649\"}\n{\"_logtype\":\"syslogline\",\"_ingester\":\"agent\",\"_ip\":\"40.121.203.183\",\"pid\":5573,\"program\":\"docker\",\"_host\":\"k8s-master-5A226838-0\",\"logsource\":\"k8s-master-5A226838-0\",\"_app\":\"syslog\",\"_file\":\"/var/log/syslog\",\"_line\":\"docker[5573]: I0411 00:18:39.644167    6124 conversion.go:134] failed to handle multiple devices for container. Skipping Filesystem stats\",\"_ts\":1491869920198,\"timestamp\":\"2017-04-11T00:18:39.000Z\",\"_id\":\"804760774821019648\"}\n{\"_logtype\":\"syslogline\",\"_ingester\":\"agent\",\"_ip\":\"40.121.203.183\",\"pid\":5573,\"program\":\"docker\",\"_host\":\"k8s-master-5A226838-0\",\"logsource\":\"k8s-master-5A226838-0\",\"_app\":\"syslog\",\"_file\":\"/var/log/syslog\",\"_line\":\"docker[5573]: I0411 00:18:37.053730    6124 operation_executor.go:917] MountVolume.SetUp succeeded for volume \\\"kubernetes.io/secret/6f322c04-e1d2-11e6-bca0-000d3a111245-default-token-swb07\\\" (spec.Name: \\\"default-token-swb07\\\") pod \\\"6f322c04-e1d2-11e6-bca0-000d3a111245\\\" (UID: \\\"6f322c04-e1d2-11e6-bca0-000d3a111245\\\").\",\"_ts\":1491869917193,\"timestamp\":\"2017-04-11T00:18:37.000Z\",\"_id\":\"804760762212941824\"}\n{\"_logtype\":\"syslogline\",\"_ingester\":\"agent\",\"_ip\":\"40.121.203.183\",\"pid\":5573,\"program\":\"docker\",\"_host\":\"k8s-master-5A226838-0\",\"logsource\":\"k8s-master-5A226838-0\",\"_app\":\"syslog\",\"_file\":\"/var/log/syslog\",\"_line\":\"docker[5573]: I0411 00:18:34.637733    6124 kubelet_node_status.go:412] Using Node Hostname from cloudprovider: \\\"k8s-master-5a226838-0\\\"\",\"_ts\":1491869915251,\"timestamp\":\"2017-04-11T00:18:34.000Z\",\"_id\":\"804760753061380102\"}\n{\"_logtype\":\"syslogline\",\"_ingester\":\"agent\",\"_ip\":\"40.121.203.183\",\"pid\":5573,\"program\":\"docker\",\"_host\":\"k8s-master-5A226838-0\",\"logsource\":\"k8s-master-5A226838-0\",\"_app\":\"syslog\",\"_file\":\"/var/log/syslog\",\"_line\":\"docker[5573]: I0411 00:18:29.574439    6124 conversion.go:134] failed to handle multiple devices for container. Skipping Filesystem stats\",\"_ts\":1491869910164,\"timestamp\":\"2017-04-11T00:18:29.000Z\",\"_id\":\"804760731720351745\"}\n{\"_logtype\":\"syslogline\",\"_ingester\":\"agent\",\"_ip\":\"40.121.203.183\",\"pid\":5573,\"program\":\"docker\",\"_host\":\"k8s-master-5A226838-0\",\"logsource\":\"k8s-master-5A226838-0\",\"_app\":\"syslog\",\"_file\":\"/var/log/syslog\",\"_line\":\"docker[5573]: I0411 00:18:29.574415    6124 conversion.go:134] failed to handle multiple devices for container. Skipping Filesystem stats\",\"_ts\":1491869910164,\"timestamp\":\"2017-04-11T00:18:29.000Z\",\"_id\":\"804760731720351744\"}\n","language":"json","status":200}]},"settings":"","examples":{"codes":[{"language":"curl","code":"curl \"https://api.logdna.com/v1/export?to=$(date +%s)000&from=$(($(date +%s)-86400))000&levels=warn\" \\\n-u INSERT_SERVICE_KEY:"}]},"auth":"required","params":[{"_id":"58ec01858d5a860f008520a5","ref":"","in":"query","required":false,"desc":"Required: Start time for logs to export, in Unix timestamp in seconds or milliseconds","default":"","type":"int","name":"from"},{"_id":"58ec01858d5a860f008520a4","ref":"","in":"query","required":false,"desc":"Required: End time for logs to export, in Unix timestamp in seconds or milliseconds","default":"","type":"int","name":"to"},{"_id":"58ec01858d5a860f008520a3","ref":"","in":"query","required":false,"desc":"Optional: Number of results to return. Depends on your plan, but generally the max is 10,000.","default":"100","type":"int","name":"size"},{"_id":"58ec042d8d5a860f0085214e","ref":"","in":"query","required":false,"desc":"Optional: comma separated list of hosts to filter by","default":"","type":"string","name":"hosts"},{"_id":"58ec042d8d5a860f0085214d","ref":"","in":"query","required":false,"desc":"Optional: comma separated list of apps to filter by","default":"","type":"string","name":"apps"},{"_id":"58ec0934f158590f00b50cde","ref":"","in":"query","required":false,"desc":"Optional: comma separated list of levels to filter by","default":"","type":"string","name":"levels"},{"_id":"58ec042d8d5a860f0085214c","ref":"","in":"query","required":false,"desc":"Optional: search query. Same format as LogDNA's log viewer. See: https://docs.logdna.com/docs/search","default":"","type":"string","name":"query"},{"_id":"58ec042d8d5a860f0085214b","ref":"","in":"query","required":false,"desc":"Optional: `head` or `tail`. Defaults to `tail`. If total results was 654 lines, `tail` would return the last 100 lines and `head` would return the first 100 lines.","default":"tail","type":"string","name":"prefer"},{"_id":"5927248a6c729e0f00597057","ref":"","in":"query","required":false,"desc":"Optional: Specifies an email that the results will be sent to, by default results are streamed back.","default":"","type":"string","name":"email"},{"_id":"5927248a6c729e0f00597056","ref":"","in":"query","required":false,"desc":"Optional: Allows user to set the subject of the email","default":"","type":"string","name":"emailSubject"}],"url":"/v1/export"},"isReference":false,"order":0,"body":"","excerpt":"Export log lines in [JSONL format](http://jsonlines.org). Before using the API, be sure to generate a [Service Key](https://app.logdna.com/manage/profile) first.","slug":"v1-export-api","type":"endpoint","title":"/v1/export"}

get/v1/export

Export log lines in [JSONL format](http://jsonlines.org). Before using the API, be sure to generate a [Service Key](https://app.logdna.com/manage/profile) first.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Query Params

from:
integer
Required: Start time for logs to export, in Unix timestamp in seconds or milliseconds
to:
integer
Required: End time for logs to export, in Unix timestamp in seconds or milliseconds
size:
integer100
Optional: Number of results to return. Depends on your plan, but generally the max is 10,000.
hosts:
string
Optional: comma separated list of hosts to filter by
apps:
string
Optional: comma separated list of apps to filter by
levels:
string
Optional: comma separated list of levels to filter by
query:
string
Optional: search query. Same format as LogDNA's log viewer. See: https://docs.logdna.com/docs/search
prefer:
stringtail
Optional: `head` or `tail`. Defaults to `tail`. If total results was 654 lines, `tail` would return the last 100 lines and `head` would return the first 100 lines.
email:
string
Optional: Specifies an email that the results will be sent to, by default results are streamed back.
emailSubject:
string
Optional: Allows user to set the subject of the email

Examples


Result Format


User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}