You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/admin/Configuration.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,18 @@ DATABASES = {
26
26
27
27
**NOTE**: The second argument to `os.getenv` is for the default value if the environment variable is not set.
28
28
29
+
## Configuration with docker-compose
30
+
When running Delve with Docker, configuration values are typically supplied via
31
+
environment variables defined in an `.env` file. The project includes a
32
+
`docker-compose.yaml` and a corresponding `.env.example` file. Copy the example
33
+
file to `.env`, update the values for your database and secret key, and
34
+
`docker-compose` will inject those settings into the containers at startup.
35
+
36
+
The standard `delve/settings.py` already looks for these environment variables,
37
+
so no additional changes are required to the image. This approach keeps secrets
38
+
out of the settings file while still allowing easy configuration for different
39
+
environments.
40
+
29
41
## Configuring Email Settings
30
42
Django provides a flexible email backend system that allows you to configure various email settings. Here are the steps to configure email settings in `settings.py`:
Copy file name to clipboardExpand all lines: doc/admin/Ingesting_Data.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,11 @@ This endpoint is provided to allow the resolution of queries.
25
25
26
26
The `/api/query` endpoint is what is used to power the Explore UI which is available at `/explore`.
27
27
28
-
The browsable REST API, which is returned when accessing `/api/query` from a browser can be really useful for debugging if you enable `DEBUG` in your `settings.py` as it allows you to track the SQL statements issued by search commands as well as a ton of other useful information.
28
+
The browsable REST API, which is returned when accessing `/api/query` from a
29
+
browser, can be really useful for debugging when the Django debug toolbar is
30
+
enabled. Setting `DEBUG=True` and installing the toolbar allows you to inspect
31
+
the SQL statements issued by search commands along with a wealth of other
Copy file name to clipboardExpand all lines: doc/admin/Installation_and_Setup.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,7 +106,23 @@ python service.py /?
106
106
```
107
107
108
108
### Installing Delve Supervisor Service on Other Platforms
109
-
This feature is coming soon. Until then, please consult your operating system's documentation for information on hosting services (Systemd, etc.) to have Delve automatically started and monitored.
109
+
On non-Windows platforms the recommended approach for running Delve is to use
110
+
Docker and `docker-compose`. The repository includes a
111
+
`docker-compose.yaml` that defines services for the web server, background
112
+
worker, and a PostgreSQL database. These containers replace the need for a
113
+
separate supervisor service by handling start-up and restart logic for you.
114
+
115
+
To get started, copy the provided `.env.example` file to `.env` and adjust the
116
+
settings for your environment. Then launch the stack:
117
+
118
+
```bash
119
+
cp .env.example .env
120
+
docker compose up -d
121
+
```
122
+
123
+
`docker-compose` will orchestrate the containers and keep them running, making
124
+
it an easy way to deploy Delve on Linux and macOS without manually configuring
For very large tables in PostgreSQL, a [BRIN index](https://www.postgresql.org/docs/current/brin-intro.html)
50
+
can dramatically reduce index size while still allowing efficient scans of
51
+
time-ordered data. Delve stores event timestamps in the `created` field of the
52
+
`events.Event` model, making it a good candidate for a BRIN index:
53
+
54
+
```sql
55
+
CREATEINDEXCONCURRENTLY events_event_created_brin
56
+
ON events_event USING BRIN (created);
57
+
```
58
+
59
+
You can also create this index via a Django migration using
60
+
`django.contrib.postgres.indexes.BrinIndex`. BRIN indexes are especially useful
61
+
when events are inserted roughly in chronological order, which is typical for
62
+
log data.
63
+
48
64
## Caching Strategies
49
65
Caching can help reduce the load on your database and improve response times. Django provides several caching backends, including in-memory caching, file-based caching, and more.
Copy file name to clipboardExpand all lines: doc/user/Getting_Started.md
+32-9Lines changed: 32 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,14 +29,23 @@ Delve is a versatile and powerful platform for ingesting, transforming, and sear
29
29
Delve is built around several core concepts that enable its powerful functionality:
30
30
31
31
### Events
32
-
Events are the basic unit of data in Delve. They are stored in a database and consist of indexed fields such as `created`, `index`, `source`, and `host`. Additionally, events contain a JSON field called `extracted_fields` for storing information extracted from the event.
32
+
Events are the basic unit of data in Delve. They are stored in a database and
33
+
consist of indexed fields such as `created`, `index`, `source`, and `host`.
34
+
Additionally, events contain a JSON field called `extracted_fields` for storing
35
+
information extracted from the event.
33
36
34
-
Events can be created through the Delve REST API or via queries using search commands, either interactively or on a scheduled basis.
37
+
Events can be created through the Delve REST API or via queries using search
38
+
commands, either interactively or on a scheduled basis. If you are writing code
39
+
against Delve itself, you may also create `Event` instances directly using the
40
+
Django ORM.
35
41
36
42
### Queries
37
43
Queries are used to retrieve, transform, and store data. They can be ephemeral or persisted in the database. A query's `text` field defines the pipeline through which events are processed using search commands.
38
44
39
-
Queries use a pipeline syntax where commands are chained together with the `|` operator, similar to command-line shells. For example:
45
+
Queries use a pipeline syntax where commands are chained together with the `|`
46
+
operator, similar to command-line shells. All whitespace in a query is collapsed
47
+
so breaking a pipeline across multiple lines is perfectly fine and can aid
48
+
readability. For example:
40
49
41
50
```bash
42
51
search --last-15-minutes index=default
@@ -54,16 +63,30 @@ Ingestion is the process of importing data into Delve. This can be done through
54
63
- **Searches**: Use interactive or scheduled queries to ingest data.
55
64
56
65
### Field Extraction and Preprocessing
57
-
Field extraction identifies and extracts specific fields from data. Delve supports:
58
-
- **Index-time Extractions**: Applied during data ingestion and persisted in the database.
59
-
- **Search-time Extractions**: Dynamically extract fields during a search (can be persisted to the database or ephemeral).
60
-
- **Preprocessing**: Take action (email, log, etc.) on certain events during ingestion.
66
+
Field extraction identifies and extracts specific fields from data. Delve
67
+
supports:
68
+
- **Index-time Extractions**: Applied during data ingestion and persisted in the
69
+
database. Update `DELVE_EXTRACTION_MAP`in`settings.py` to map sourcetypes to
70
+
the appropriate extraction functions.
71
+
- **Search-time Extractions**: Dynamically extract fields during a search (can
72
+
be persisted to the database or ephemeral). The `qs_update` search command can
73
+
be used to update events at search time after new fields are extracted.
74
+
- **Preprocessing**: Take action (email, log, etc.) on certain events during
Search functionality allows querying and filtering data, as well as performing transformations, visualizations, and more. Delve supports custom search commands written in Python, which can be registered in the configuration.
79
+
Search functionality allows querying and filtering data, as well as performing
80
+
transformations, visualizations, and more. Delve supports custom search
81
+
commands written in Python, which can be registered in the configuration. The
82
+
`DELVE_SEARCH_COMMANDS` setting in`settings.py` can be updated to add or remove
83
+
available search commands.
64
84
65
85
### Custom Apps
66
-
Delve enables the creation of custom apps to group related data and code. These apps can include custom search commands, dashboards, REST API endpoints, and more.
86
+
Delve enables the creation of custom apps to group related data and code. These
87
+
apps can include custom search commands, dashboards, REST API endpoints, and
88
+
more. Custom apps are added to the `INSTALLED_APPS` setting in`settings.py` so
89
+
that Django knows to load them.
67
90
68
91
### Alerts
69
92
Delve provides search-based and processor-based alerts:
Copy file name to clipboardExpand all lines: doc/user/Searching_Filtering_and_More.md
+36-20Lines changed: 36 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,13 @@ Queryset transformation commands act on Django Querysets (such as the output of
25
25
26
26
## Generic Transformations
27
27
28
-
Generic transformation commands modify data from a source command in some way. These commands are designed to be versatile and work well with diverse sets of data, although they may be slower than their `qs_` counterparts.
28
+
Generic transformation commands modify data from a source command in some way.
29
+
While Queryset Transformations accept and return Django `QuerySet` objects,
30
+
Generic Transformations are designed to accept and return arbitrary Python data
31
+
structures (`int`, `str`, `list`, `dict`, `tuple`, etc.). A list of dictionaries
32
+
representing rows is a common pattern. These commands are versatile and work
33
+
well with diverse sets of data, although they may be slower than their `qs_`
In this example, `{{ index }}` and `{{ keyword }}` are Jinja2 template variables that will be replaced with their corresponding values from the context.
135
141
136
-
This can be useful forincluding different sets of arguments to the same search command to get different results or behavior. It can also be used with the `query_table` and `query_chart` templatetags which accept Django Form instances for usein dashboards and control panels.
142
+
This can be useful for including different sets of arguments to the same search
143
+
command to get different results or behavior. Combined with the `query_table`
144
+
and `query_chart` templatetags, a Django `Form` instance can be rendered in a
145
+
dashboard to collect user input and feed values directly into a query. This
146
+
combination of forms, template tags, and Jinja2 templating makes it easy to
147
+
build powerful interactive dashboards and control panels.
137
148
138
149
## send_email Command
139
-
The `send_email`command allows you to send email notifications based on the result set. This command is configured using Django's SMTP settings. For example:
150
+
The `send_email`command allows you to send email notifications based on the
151
+
result set. This command is configured using Django's SMTP settings and only
152
+
sends an email when the result set contains at least one event. For example:
Delve allows you to create custom search commands in Python and register them in `settings.py` under `DELVE_SEARCH_COMMANDS`. This provides powerful and flexible ways to manipulate the result set.
191
+
To create a custom search command, first build an `argparse.ArgumentParser` to
192
+
describe any arguments the command accepts. Then write a function that operates
193
+
on the events and wrap it with the
194
+
`events.search_commands.decorators.search_command` decorator, passing the parser
195
+
instance. The decorator parses the arguments and supplies them to your
0 commit comments