Skip to content

Commit e79d1be

Browse files
committed
rsyslog: Implement suggestions by CodeRabbit
1 parent 2208b53 commit e79d1be

File tree

2 files changed

+31
-26
lines changed

2 files changed

+31
-26
lines changed

docs/ingest/telemetry/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
(metrics-store)=
33
(telemetry)=
44
(integrate-metrics)=
5-
# Metrics, telemetry, and logging data
5+
# Metrics, telemetry, and logs
66

77
:::::{grid}
88
:padding: 0
@@ -59,10 +59,10 @@ Prometheus is an open-source systems monitoring and alerting toolkit
5959
for collecting metrics data from applications and infrastructures.
6060
::::
6161

62-
::::{grid-item-card} Rsyslog
62+
::::{grid-item-card} rsyslog
6363
:link: rsyslog
6464
:link-type: ref
65-
Rsyslog is a rocket-fast system for log processing.
65+
Send logs with rsyslog, a rocketfast system for log processing.
6666
::::
6767

6868
::::{grid-item-card} Telegraf

docs/integrate/rsyslog/tutorial.md

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,35 @@
11
(rsyslog-tutorial)=
2-
# Storing server logs on CrateDB for fast search and aggregations
2+
# Store server logs on CrateDB for fast search and aggregations
33

44
## Introduction
55

6-
Did you know that CrateDB can be a great store for your server logs?
6+
CrateDB stores server logs efficiently and makes them easy to query.
77

8-
If you have been using log aggregation tools or even some of the most advanced commercial SIEM systems, you have probably experienced the same frustrations I have:
8+
Common pain points with traditional log stacks and SIEMs include:
99

10-
* timeouts when searching logs over long periods of time
11-
* a complex and proprietary query syntax
12-
* difficulties integrating queries on logs data into application monitoring dashboards
10+
* timeouts when searching across long time ranges
11+
* proprietary, complex query syntaxes
12+
* awkward integrations with application monitoring dashboards
1313

14-
Storing server logs on CrateDB solves these problems, it allows to query the logs with standard SQL and from any tool supporting the PostgreSQL protocol; its unique indexing also makes full-text queries and aggregations super fast.
15-
Let me show you an example.
14+
CrateDB addresses these issues: query logs with standard SQL from any
15+
PostgreSQL‑compatible tool, and use full‑text search and aggregations
16+
backed by efficient indexes. The sections below walk through a minimal
17+
setup.
1618

1719
## Setup
1820

1921
### CrateDB
2022

21-
First, we will need an instance of CrateDB, it may be best to have a dedicated cluster for this purpose, to separate the monitoring system from the systems being monitored, but for the purpose of this demo we can just have a single node cluster on a docker container:
23+
First, start CrateDB. For production, use a dedicated cluster. For this demo, run a singlenode container:
2224

2325
```bash
24-
sudo docker run -d --name cratedb --publish 4200:4200 --publish 5432:5432 --env CRATE_HEAP_SIZE=1g crate -Cdiscovery.type=single-node
26+
sudo docker run -d --name cratedb \
27+
-p 4200:4200 -p 5432:5432 \
28+
-e CRATE_HEAP_SIZE=1g \
29+
crate:5.6.0 -Cdiscovery.type=single-node
2530
```
2631

27-
Next, we need a table to store the logs, let's connect to `http://localhost:4200/#!/console` and run:
32+
Next, create a table for logs. Open `http://localhost:4200/#!/console` and run:
2833

2934
```sql
3035
CREATE TABLE doc.systemevents (
@@ -39,7 +44,7 @@ CREATE TABLE doc.systemevents (
3944
SysLogTag TEXT
4045
);
4146
```
42-
Tip: if you are on a headless system you can also run queries with {ref}`command-line tools <connect-cli>`.
47+
Tip: On headless systems, run queries with the {ref}`command-line tools <connect-cli>`.
4348

4449
Then we need an account for the logging system:
4550

@@ -59,11 +64,10 @@ GRANT DML ON TABLE doc.systemevents TO rsyslog;
5964
We will use [rsyslog](https://github.com/rsyslog/rsyslog) to send the logs to CrateDB, for this setup we need `rsyslog` v8.2202 or higher and the `ompgsql` module:
6065

6166
```bash
62-
sudo add-apt-repository ppa:adiscon/v8-stable
63-
sudo apt-get update
64-
sudo apt-get install rsyslog
67+
sudo add-apt-repository -y ppa:adiscon/v8-stable
68+
sudo apt-get update -y
6569
sudo debconf-set-selections <<< 'rsyslog-pgsql rsyslog-pgsql/dbconfig-install string false'
66-
sudo apt-get install rsyslog-pgsql
70+
sudo apt-get install -y rsyslog rsyslog-pgsql
6771
```
6872

6973
Let's now configure it to use the account we created earlier:
@@ -79,20 +83,20 @@ If you are interested in more advanced setups involving queuing for additional r
7983

8084
### MediaWiki
8185

82-
Now let's imagine that we want to run a container with [MediaWiki](https://www.mediawiki.org/wiki/MediaWiki) to host an intranet and we want all logs to go to CrateDB, we can just deploy this with:
86+
To generate logs, run a [MediaWiki](https://www.mediawiki.org/wiki/MediaWiki) container and forward its logs to rsyslog:
8387

8488
```bash
8589
sudo docker run --name mediawiki -p 80:80 -d --log-driver syslog --log-opt syslog-address=unixgram:///dev/log mediawiki
8690
```
8791

88-
If we now point a web browser to port 80 at `http://localhost/`, you will see a new MediaWiki page.
89-
Let's play around a bit to generate log entries, just click on "set up the wiki" and then once on Continue.
90-
This will have generated entries in the `doc.systemevents` table with `syslogtag` matching the container id of the container running the site.
92+
Open `http://localhost/` to see the MediaWiki setup page.
93+
Click “set up the wiki”, then “Continue” to generate log entries.
94+
CrateDB now stores new rows in `doc.systemevents`, with `syslogtag` matching the container ID.
9195

9296

9397
## Explore
9498

95-
We can now use the {ref}`crate-reference:predicates_match` to find the error messages we are interested in:
99+
Use {ref}`crate-reference:predicates_match` to find specific error messages:
96100

97101
```sql
98102
SELECT devicereportedtime,message
@@ -110,7 +114,7 @@ ORDER BY 1 DESC;
110114
+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
111115
```
112116

113-
Let's now see which log sources created the most entries:
117+
Show the top log sources by event count:
114118

115119
```sql
116120
SELECT syslogtag,count(*)
@@ -132,4 +136,5 @@ LIMIT 5;
132136
+----------------------+----------+
133137
```
134138

135-
I hope you found this interesting. Please do not hesitate to let us know your thoughts in the [CrateDB Community](https://community.cratedb.com/).
139+
We hope this was useful. Share feedback and questions in the
140+
[CrateDB Community](https://community.cratedb.com/).

0 commit comments

Comments
 (0)