API: Manage Sources

[obsolete]

Input APIs

These APIs provide methods to manage inputs associated with your Loggly account.

All APIs will require an [id] specific to the input you set up within Loggly. To find the correct [id]:

  • Go to the inputs dashboard
  • Click on the link to your input
  • Look at the URL, you'll find the [id] at the end of the URL (e.g. In this example it's "15": https://example.loggly.com/inputs/15)

Get list of inputs

/inputs/[id]/

HTTP GET
Provides an input or list of inputs for an account.

curl -u <username>:<password> 'https://<subdomain>.loggly.com/api/inputs/'

Use either the ID or input name to query a specific input:

curl -u <username>:<password> 'https://<subdomain>.loggly.com/api/inputs/10'

This example queries the input with ID 10.

curl -u <username>:<password> 'https://<subdomain>.loggly.com/api/inputs/?name=mytestinput'

This example queries the input with name 'mytestinput'. You can use this in case you don't know the ID of an input. The name parameter works for all GET calls on the input API.

Sample JSON Output for a Syslog input

Sample JSON Output for an HTTPS input

Create an input

/inputs/[id]/

HTTP POST

Creates a new input on your account.

POST Parameters

name:   Name the input.
description:   Provide a description for the input.
service:  

Specify a service type (syslogudp | syslogtcp | http | syslog_tls | syslog_tls_strip | syslogtcp_strip | syslogudp_strip)

format:   Specify whether input is JSON enabled (indexed as JSON) or raw text (defaults to text if not specified). 
curl -X POST -u <username>:<password> "content-type:text/plain" -d 'name=My Input' -d 'description=My new super input' -d 'service=syslogtcp' -d 'format=json' 'https://<subdomain>.loggly.com/api/inputs/'

Sample JSON Output

Add a device to an input

/inputs/[id]/adddevice/

HTTP POST

Programmatically adds the calling device to an input, allowing it to send the input data. See the configuration management page for more information on automatically enabling a server to send Loggly data. This call uses the requesting host's IP for the added device. If you need to add a different device, use the /devices/ API.

It's important to note that the ability to create devices on HTTPS inputs isn't possible.

curl -X POST https://<username>:<password>@<subdomain>.loggly.com/api/inputs/<id>/adddevice/

Remove a device from an input

/inputs/<id>/removedevice/

HTTP POST

Programmatically removes the calling device from an input. This call uses the requesting host's IP for it to be removed. If you need to remove a different device, use the /devices/ call.

curl -X POST https://<username>:<password>@<subdomain>.loggly.com/api/inputs/<id>/removedevice/

Put an input into discovery mode

/inputs/<id>/discover

HTTP POST

Puts the input with ID <id> into discovery mode.

curl -X POST https://<username>:<password>@<subdomain>.loggly.com/api/inputs/<id>/discover

Take an input out of discovery mode

HTTP DELETE

Takes an input out of discovery mode.

curl -X DELETE https://<username>:<password>@<subdomain>.loggly.com/api/inputs/<id>/discover

 

 

Devices APIs

These APIs provide methods to manage devices associated with your Loggly account.

All APIs will require an [id] specific to the device you set up within Loggly. To find the correct [id]:

  • Go to the devices dashboard
  • Click on the link to your device
  • Look at the URL, you'll find the [id] at the end of the URL (e.g. In this example it's "12345": https://example.loggly.com/devices/12345)

 

Get list of devices

/devices/[id]/

HTTP GET

Provides a device or list of devices for an account.

curl -u [user]:[pass] 'https://[subdomain].loggly.com/api/devices/'

JSON Output

Add a device to an input

HTTP POST

POST Parameters

input_id:   Integer id for the input which will receive data from this device.
ip:   Quad octet IP address of device which will send data to the input.
name:   The name you'd like to call the device.

 

curl -X POST -u [username]:[password] -H "content-type:text/plain" -d input_id=314 -d ip=20.20.20.20 -d name=myhost "https://[subdomain].loggly.com/api/devices/"

Deletes a device from an input

HTTP DELETE

Provide the device ID or IP address

curl -X DELETE https://[username]:[password]@[subdomain].loggly.com/api/devices/15
curl -X DELETE https://[username]:[password]@[subdomain].loggly.com/api/devices/10.20.1.233

 

Response Codes

These are fairly standard HTTP/RESTful response codes. From time to time we'll use them in our replies to your queries.

Status Message Description
200 OK Indicates that the request was successful.
201 Created The object was successfully created. This is for a POST call.
204 Deleted The object was deleted. This pertains to DELETE calls.
400 Bad Request Check your request parameters. You might be using an unsupported parameter or have a malformed something or another.
401 Unauthorized Either your credentials specified were invalid.
403 Forbidden User does not have privileges to execute the action.
404 Not Found The resource you have referenced could not be found.
409 Conflict/Duplicate There was some conflict. Most likely you are trying to create a resource that already exists.
410 Gone You have referenced an object that does not exist.
500 Internal Server Error There has been an error from which Loggly could not recover. We are likely notified when this happens.
501 Not Implemented You are trying to access functionality that is not implemented. Yet.
503 Throttled Like a needy child, you are overloading us with requests for events. Try again later.
Top