Graylog. Say I collect logs from pods in Kubernetes. I can filter by namespace and I…
- User
Graylog. Say I collect logs from pods in Kubernetes.
I can filter by namespace and I know that the pods hostname are in the source. However I don't know all the possible pods names (because some were replaced and thus the name is unknown but I know that the messages were logged). How can I search in Graylog for a given hostname all the possible sources, without going through all possible messages?
Assistant
In Graylog, you can find all unique source values (pod hostnames) without browsing through individual messages using these approaches:
1. Quick Values / Field Statistics
The easiest method:
- Search for your namespace filter (e.g.,
namespace:"your-namespace") - In the search results, find the "source" field in the fields sidebar
- Click on the field name or the small chart icon next to it
- This opens "Quick Values" showing all unique values for that field with their counts
2. Aggregation Search
Create an aggregation query:
- Go to Search
- Apply your namespace filter
- Click on "Create aggregation" or switch to the aggregation tab
- Configure:
- Metric: Count
- Group by: source
- Visualization: Data table
- This will show all unique sources with message counts
3. Using Graylog API
Query the terms aggregation endpoint:
curl -X POST "http://your-graylog:9000/api/search/universal/relative/terms" \ -H "Authorization: Basic <your-auth>" \ -H "Content-Type: application/json" \ -d '{ "field": "source", "query": "namespace:your-namespace", "range": 86400, "size": 1000 }'4. Dashboard Widget
Create a permanent view:
- Create a new dashboard
- Add a "Data Table" widget
- Configure it to group by "source" field
- Apply your namespace filter
- This gives you a reusable view of all sources
The Quick Values approach is usually the fastest for ad-hoc queries, while dashboards are better for ongoing monitoring of pod sources in your namespace.
- Search for your namespace filter (e.g.,
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.