How Kong Improves API Management with a new Plugin for Loggly

 

How Kong Improves API Management with a New Plugin for Loggly

Loggly is excited to announce our partnership with Mashape through direct integration with Kong, the most popular open-source API management platform. Kong features a plugin-oriented architecture which allows you to set up authentication, transformations, security, and manage traffic controls. And now with Loggly’s plugin, you can log requests and response data.

Loggly is a log management tool that collects your log data using existing open standards like syslog and HTTP; therefore, you no longer have to install a heavy, proprietary collection on every machine. Loggly provides real-time, navigable summaries of log data it automatically parses in addition to powerful search, filtering, and analysis capabilities.

Through Kong’s powerful plugin system the Loggly plugin can log request/response data from your Kong nodes directly to Loggly’s service. Now you can easily answer questions such as:

Performance Monitoring

“How is my API stack performing? Is my API any slower than expected? Are transactions completing successfully?”

Alert and Report on Errors

“How can I see the top errors or exceptions affecting my API? How will I know when there is a big spike in errors?”

Trace Requests

“Why did a high-value API call fail? What part of the request had a problem?”

Getting Started

The Loggly Plugin can capture all API requests and responses. Follow these steps to enable the plugin:

1. Enable the plugin by running this request:

$ curl -X POST http://kong:8001/apis/{api}/plugins \
   --data "name=loggly" \
   --data "config.key=YOUR_LOGGLY_SERVICE_TOKEN"

2. Verify Loggly receives the logs:

Loggly receiving Kong data

You can review the supported configurations for more customization.

Every request will be transmitted to Loggly in SYSLOG standard, with the message component in this JSON format:

{
    "request": {
        "method": "GET",
        "uri": "/get",
        "size": "75",
        "request_uri": "http://mockbin.org:8000/get",
        "querystring": {},
        "headers": {
            "accept": "*/*",
            "host": "mockbin.org",
            "user-agent": "curl/7.37.1"
        }
    },
    "response": {
        "status": 200,
        "size": "434",
        "headers": {
            "Content-Length": "197",
            "via": "kong/0.3.0",
            "Connection": "close",
            "access-control-allow-credentials": "true",
            "Content-Type": "application/json",
            "server": "nginx",
            "access-control-allow-origin": "*"
        }
    },
    "authenticated_entity": {
        "consumer_id": "80f74eef-31b8-45d5-c525-ae532297ea8e",
        "created_at":   1437643103000,
        "id": "eaa330c0-4cff-47f5-c79e-b2e4f355207e",
        "key": "2b64e2f0193851d4135a2e885cd08a65"
    },
    "api": {
        "request_host": "test.com",
        "upstream_url": "http://mockbin.org/",
        "created_at": 1432855823000,
        "name": "test.com",
        "id": "fbaf95a1-cd04-4bf6-cb73-6cb3285fef58"
    },
    "latencies": {
        "proxy": 1430,
        "kong": 9,
        "request": 1921
    },
    "started_at": 1433209822425,
    "client_ip": "127.0.0.1"
}

Congratulations, the Loggly plugin has been properly configured! Developers now have the flexibility of defining severity and logging levels for their APIs and Microservices.

Conclusion

The popularity of Loggly made it a natural fit for an early Kong plugin. Being able to quickly pinpoint the source and impact of issues in an emergency is mission critical. Kong is excited to be partnering with Loggly to offer developers easier, better API management.

Try the plugin today and experience the best of Kong and Loggly.

If you’re in San Francisco, check out the Kong MeetUp with Loggly – Jan 28th at 6:30pm.

Kong MeetUp


Share Your Thoughts

Top