Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ Configure the module in `/etc/apache2/mods-enabled/log_gelf.conf`:
GelfCookie "tracking"
GelfFields "ABDhmsvRti"
```

You can use GelfSource "CURRENT_HOSTNAME" in order to use name of the host where apache is running.

On CentOS both files are combined in `/etc/httpd/conf.modules.d/02-gelf.conf`

| Parameter | Argument | Description |
Expand Down
9 changes: 8 additions & 1 deletion src/mod_log_gelf.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,14 @@ static const char *set_gelf_tag(cmd_parms *cmd, void *cfg, const char *arg) {
/* Override source field */
static const char *set_gelf_source(cmd_parms *cmd, void *cfg, const char *arg) {
gelf_config *config = ap_get_module_config(cmd->server->module_config, &log_gelf_module);
config->source = arg;
if (strcmp(arg,"CURRENT_HOSTNAME") == 0) {
char local_hostname[1024];
local_hostname[1023]='\0';
gethostname(local_hostname, 1023);
config->source = strdup(local_hostname);
} else {
config->source = arg;
}
return NULL;
}

Expand Down