Invoke-RestMethod is a command to interact with REST APIs in PowerShell. Invoke-RestMethod is a quick and easy way to test your configuration or troubleshoot your connectivity to Logz.io.
You can upload JSON or plain text files.
Limitations
- Max body size is 10 MB (10,485,760 bytes)
- Each log line must be 500,000 bytes or less
- Note that if you include a
type
field in the log, it will be overridden by the type written in the request parameter
Upload a JSON log file
Before you begin, you’ll need: PowerShell
Upload the file
If you want to ship logs from your code but don’t have a library in place, you can send them directly to the Logz.io listener as a minified JSON file.
Invoke-RestMethod -method POST -Uri https://<<LISTENER-HOST>>:8071?token=<<LOG-SHIPPING-TOKEN>>"&"<<LOG-TYPE>> -InFile <<PATH/TO/LOG/FILE.JSON>>
Replace the placeholders to match your specifics. (They are indicated by the double angle brackets << >>
):
-
Replace
<<LOG-SHIPPING-TOKEN>>
with the token of the account you want to ship to. -
Replace
<<LISTENER-HOST>>
with the host for your region. For example,listener.logz.io
if your account is hosted on AWS US East, orlistener-nl.logz.io
if hosted on Azure West Europe. The required port depends whether HTTP or HTTPS is used: HTTP = 8070, HTTPS = 8071. - Declare your log type for parsing purposes. Logz.io applies default parsing pipelines to the following list of built-in log types. If you declare another type, contact support for assistance with custom parsing. Can’t contain spaces. Otherwise, the default
type
ishttp-bulk
. - Replace
<<PATH/TO/LOG/FILE.JSON>>
with the path to your log file.
Check Logz.io for your logs
Give your logs some time to get from your system to ours, and then open Open Search Dashboards.
If you still don’t see your logs, see log shipping troubleshooting.
Invoke-RestMethod is a command to interact with REST APIs in PowerShell. Invoke-RestMethod is a quick and easy way to test your configuration or troubleshoot your connectivity to Logz.io.
You can upload JSON or plain text files.
Limitations
- Max body size is 30 MB (31,457,280 bytes)
- Note that if you include a
type
field in the log, it will be overridden by the type written in the request parameter
Upload a plain text log file
Before you begin, you’ll need: PowerShell
Upload the file
Invoke-RestMethod -method POST -Uri https://<<LISTENER-HOST>>:8022/file_upload/<<LOG-SHIPPING-TOKEN>>/<<LOG-TYPE>> -InFile <<PATH/TO/LOG/FILE>>
Replace the placeholders to match your specifics. (They are indicated by the double angle brackets << >>
):
-
Replace
<<LOG-SHIPPING-TOKEN>>
with the token of the account you want to ship to. -
Declare your log type for parsing purposes. Logz.io applies default parsing pipelines to the following list of built-in log types. If you declare another type, contact support for assistance with custom parsing. Can’t contain spaces. Otherwise, the default
type
ishttp-bulk
. -
Replace
<<PATH/TO/LOG/FILE>>
with the path to your log file.
Check Logz.io for your logs
Give your logs some time to get from your system to ours, and then open Open Search Dashboards.
If you still don’t see your logs, see log shipping troubleshooting.