Skip to main content

Invoke RestMethod

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
  • If you include a type field in the log, it overrides type in the request header

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, or listener-nl.logz.io if hosted on Azure West Europe.

  • 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 is http-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.