# Logs of a source using api

**URL:** https://community.graylog.org/t/logs-of-a-source-using-api/21555
**Category:** Graylog Central (peer support)
**Created:** [October 23, 2021, 9:44am UTC](https://community.graylog.org/t/logs-of-a-source-using-api/21555 "2021-10-23T09:44:12Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![linuxuser](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@linuxuser](https://community.graylog.org/u/linuxuser)
#### Post date: [October 23, 2021, 9:44am UTC](https://community.graylog.org/t/logs-of-a-source-using-api/21555/1 "2021-10-23T09:44:12Z")

</div>

How can we fetch the logs of a particular source using graylog api and which api will be used for that? Please guide me regrading this.

---

<div class="post-metadata">

### Author: ![tmacgbay](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/tmacgbay/32/3878_2.png) [@tmacgbay](https://community.graylog.org/u/tmacgbay)
#### Post date: [October 23, 2021, 5:13pm UTC](https://community.graylog.org/t/logs-of-a-source-using-api/21555/2 "2021-10-23T17:13:49Z")

</div>

- Did you read through the [instructions](https://docs.graylog.org/docs/rest-api)?
- Did you try anything? You could post what you found to be close and ask for more detail…
- You could mention your environment… what version of Graylog are you using? The answer might be different…
- It helps to read through [this](https://community.graylog.org/t/how-to-post-a-question-in-the-community-that-gets-responses/20879) about asking questions in forums.

Generally people in the forums like helping others who have worked at the problem and are stumped … and share their settings… and share what they have tried to resolve the problem…

---

<div class="post-metadata">

### Author: ![linuxuser](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@linuxuser](https://community.graylog.org/u/linuxuser)
#### Post date: [October 25, 2021, 5:13am UTC](https://community.graylog.org/t/logs-of-a-source-using-api/21555/3 "2021-10-25T05:13:59Z")

</div>

I followed up this link and try to fetch the details using api. And i also get the cluster information but didn’t get any specific api to get the logs from a particular source. Kindly guide me to get out of this.

[https://archivedocs.graylog.org/en/3.0/pages/configuration/rest\_api.html#creating-and-using-access-token](https://archivedocs.graylog.org/en/3.0/pages/configuration/rest_api.html#creating-and-using-access-token)  
curl -u GM:admin-H ‘Accept: application/json’ -X GET ‘[http://192.168.1.211:9000/api/cluster](http://192.168.1.211:9000/api/cluster)’

 ![image](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/4/4f3e1340aee2e4a4524f7b355f20b790d28f1b16.png)

---

<div class="post-metadata">

### Author: ![tmacgbay](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/tmacgbay/32/3878_2.png) [@tmacgbay](https://community.graylog.org/u/tmacgbay)
#### Post date: [October 25, 2021, 2:05pm UTC](https://community.graylog.org/t/logs-of-a-source-using-api/21555/4 "2021-10-25T14:05:30Z")

</div>

A quick search of the forums found this post that might give you a start on how to build an API query for what you want.

> [@How to search messages using REST API](https://community.graylog.org/t/how-to-search-messages-using-rest-api/17943/6):
>
> one open would be to use the relative time, Include the streams ID you want to search in, include the query string in the query\_string object and the time you want to search as relative. The below search will return as CSV/export. ## Search via Export API curl -X "POST" "https://graylog.ch/api/views/search/messages" \ -H 'X-Requested-By: Mamamia' \ -H 'Content-Type: application/json' \ -H 'Accept: text/csv' \ -u 'admin:password' \ -d $'{ "streams": [ "5e569003c7…

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/3X/c/7/c7c09c6b5099570133d6502b83f50ba4430de5b6.png) [@system](https://community.graylog.org/u/system)
#### Post date: [November 8, 2021, 2:06pm UTC](https://community.graylog.org/t/logs-of-a-source-using-api/21555/5 "2021-11-08T14:06:06Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
