Skip to content

Commit 0e63944

Browse files
learning the git - correction of all warnings and also improvement of the documentation
1 parent 09e237a commit 0e63944

File tree

5 files changed

+45
-41
lines changed

5 files changed

+45
-41
lines changed

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ Configure the module in `/etc/apache2/mods-enabled/log_gelf.conf`:
6060
```
6161
On CentOS both files are combined in `/etc/httpd/conf.modules.d/02-gelf.conf`
6262

63-
| Parameter | Argument | Description |
64-
|--------------|------------------------|----------------------------------------------------|
65-
| GelfEnabled | On/Off | Load GELF logging module |
66-
| GelfUrl | Graylog server URL | Set IP and port of a UDP GELF input |
67-
| GelfSource | (Optional) | Overwrite source field |
68-
| GelfFacility | (Optional) | Overwrite logging facility |
69-
| GelfTag | (Optional) | Add a `tag` field to every log message |
70-
| GelfCookie | (Optional) cookie name | Extract cookie from web request, Use 'c' GelfField |
71-
| GelfHeader | (Optional) header name | Extract header from web request, Use 'X' GelfField |
72-
| GelfFields | (Optional) | Configures which information should be logged |
63+
| Parameter | Argument | Description |
64+
|--------------|------------------------|--------------------------------------------------------|
65+
| GelfEnabled | On/Off | Load GELF logging module |
66+
| GelfUrl | Graylog server URL | Set IP and port of a UDP GELF input |
67+
| GelfSource | (Optional) | Overwrite source field |
68+
| GelfFacility | (Optional) | Overwrite logging facility |
69+
| GelfTag | (Optional) | Add a `tag` field to every log message |
70+
| GelfCookie | (Optional) cookie name | Extract one cookie from web request, Use 'c' GelfField |
71+
| GelfHeader | (Optional) header name | Extract one header from web request, Use 'X' GelfField |
72+
| GelfFields | (Optional) | Configures which information should be logged |
7373

7474
What does the `GelfFields` string mean:
7575

@@ -80,6 +80,8 @@ What does the `GelfFields` string mean:
8080
| B | Bytes send |
8181
| C | Connection status |
8282
| c | Extract Cookie |
83+
| | (name must be in |
84+
| | GelfCookie) |
8385
| D | Request duration |
8486
| | (in microseconds) |
8587
| f | Requested file |
@@ -100,6 +102,8 @@ What does the `GelfFields` string mean:
100102
| V | Server name |
101103
| v | VirtualHost name |
102104
| X | Extract Header |
105+
| | (name must be in |
106+
| | GelfHeader) |
103107

104108
# Packages
105109

src/functions.h

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
* value to the calling entity.
44
*/
55

6-
static const json_object *extract_remote_host(request_rec *r, char *a)
6+
json_object *extract_remote_host(request_rec *r, char *a)
77
{
88
return json_object_new_string(ap_get_remote_host(r->connection, r->per_dir_config, REMOTE_NAME, NULL));
99
}
1010

11-
static const json_object *extract_remote_address(request_rec *r, char *a) __attribute__((unused));
11+
json_object *extract_remote_address(request_rec *r, char *a) __attribute__((unused));
1212

13-
static const json_object *extract_remote_address(request_rec *r, char *a)
13+
json_object *extract_remote_address(request_rec *r, char *a)
1414
{
1515
#ifdef WITH_APACHE22
1616
return json_object_new_string(r->connection->remote_ip);
@@ -19,14 +19,14 @@ static const json_object *extract_remote_address(request_rec *r, char *a)
1919
#endif
2020
}
2121

22-
static const json_object *extract_local_address(request_rec *r, char *a) __attribute__((unused));
22+
json_object *extract_local_address(request_rec *r, char *a) __attribute__((unused));
2323

24-
static const json_object *extract_local_address(request_rec *r, char *a)
24+
json_object *extract_local_address(request_rec *r, char *a)
2525
{
2626
return json_object_new_string(r->connection->local_ip);
2727
}
2828

29-
static const json_object *extract_remote_logname(request_rec *r, char *a)
29+
json_object *extract_remote_logname(request_rec *r, char *a)
3030
{
3131
const char *rlogin = ap_get_remote_logname(r);
3232
if (rlogin == NULL) {
@@ -38,7 +38,7 @@ static const json_object *extract_remote_logname(request_rec *r, char *a)
3838
return json_object_new_string(rlogin);
3939
}
4040

41-
static const json_object *extract_remote_user(request_rec *r, char *a)
41+
json_object *extract_remote_user(request_rec *r, char *a)
4242
{
4343
#ifdef WITH_APACHE13
4444
char *rvalue = r->connection->user;
@@ -53,7 +53,7 @@ static const json_object *extract_remote_user(request_rec *r, char *a)
5353
return json_object_new_string(rvalue);
5454
}
5555

56-
static const json_object *extract_request_line(request_rec *r, char *a)
56+
json_object *extract_request_line(request_rec *r, char *a)
5757
{
5858
/* Upddated to mod_log_config logic */
5959
/* NOTE: If the original request contained a password, we
@@ -71,34 +71,34 @@ static const json_object *extract_request_line(request_rec *r, char *a)
7171
: r->the_request);
7272
}
7373

74-
static const json_object *extract_request_file(request_rec *r, char *a)
74+
json_object *extract_request_file(request_rec *r, char *a)
7575
{
7676
return json_object_new_string(r->filename);
7777
}
7878

79-
static const json_object *extract_request_uri(request_rec *r, char *a)
79+
json_object *extract_request_uri(request_rec *r, char *a)
8080
{
8181
return json_object_new_string(r->uri);
8282
}
8383

84-
static const json_object *extract_request_method(request_rec *r, char *a)
84+
json_object *extract_request_method(request_rec *r, char *a)
8585
{
8686
return json_object_new_string(r->method);
8787
}
8888

89-
static const json_object *extract_request_protocol(request_rec *r, char *a)
89+
json_object *extract_request_protocol(request_rec *r, char *a)
9090
{
9191
return json_object_new_string(r->protocol);
9292
}
9393

94-
static const json_object *extract_request_query(request_rec *r, char *a)
94+
json_object *extract_request_query(request_rec *r, char *a)
9595
{
9696
return json_object_new_string((r->args) ? apr_pstrcat(r->pool, "?",
9797
r->args, NULL)
9898
: "");
9999
}
100100

101-
static const json_object *extract_status(request_rec *r, char *a)
101+
json_object *extract_status(request_rec *r, char *a)
102102
{
103103
if (r->status <= 0) {
104104
return NULL;
@@ -107,17 +107,17 @@ static const json_object *extract_status(request_rec *r, char *a)
107107
}
108108
}
109109

110-
static const json_object *extract_virtual_host(request_rec *r, char *a)
110+
json_object *extract_virtual_host(request_rec *r, char *a)
111111
{
112112
return json_object_new_string(r->server->server_hostname);
113113
}
114114

115-
static const json_object *extract_server_name(request_rec *r, char *a)
115+
json_object *extract_server_name(request_rec *r, char *a)
116116
{
117117
return json_object_new_string(ap_get_server_name(r));
118118
}
119119

120-
static const json_object *extract_server_port(request_rec *r, char *a)
120+
json_object *extract_server_port(request_rec *r, char *a)
121121
{
122122
return json_object_new_string(apr_psprintf(r->pool, "%u",
123123
r->server->port ? r->server->port : ap_default_port(r)));
@@ -132,7 +132,7 @@ static const char *log_server_name(request_rec *r, char *a)
132132
return ap_get_server_name(r);
133133
}
134134

135-
static const json_object *extract_child_pid(request_rec *r, char *a)
135+
json_object *extract_child_pid(request_rec *r, char *a)
136136
{
137137
if (*a == '\0' || !strcmp(a, "pid")) {
138138
return json_object_new_string(apr_psprintf(r->pool, "%" APR_PID_T_FMT, getpid()));
@@ -149,7 +149,7 @@ static const json_object *extract_child_pid(request_rec *r, char *a)
149149
return json_object_new_string(a);
150150
}
151151

152-
static const json_object *extract_header(request_rec *r, char *a)
152+
json_object *extract_header(request_rec *r, char *a)
153153
{
154154
const char *tempref;
155155

@@ -162,7 +162,7 @@ static const json_object *extract_header(request_rec *r, char *a)
162162
}
163163
}
164164

165-
static const json_object *extract_referer(request_rec *r, char *a)
165+
json_object *extract_referer(request_rec *r, char *a)
166166
{
167167
const char *tempref;
168168

@@ -175,7 +175,7 @@ static const json_object *extract_referer(request_rec *r, char *a)
175175
}
176176
}
177177

178-
static const json_object *extract_agent(request_rec *r, char *a)
178+
json_object *extract_agent(request_rec *r, char *a)
179179
{
180180
const char *tempag;
181181

@@ -188,7 +188,7 @@ static const json_object *extract_agent(request_rec *r, char *a)
188188
}
189189
}
190190

191-
static const json_object *extract_specific_cookie(request_rec *r, char *a)
191+
json_object *extract_specific_cookie(request_rec *r, char *a)
192192
{
193193
const char *cookiestr;
194194
char *cookieend;

src/functions20.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
static const json_object *extract_bytes_sent(request_rec *r, char *a)
1+
json_object *extract_bytes_sent(request_rec *r, char *a)
22
{
33
if (!r->sent_bodyct || !r->bytes_sent) {
44
return NULL;
@@ -7,7 +7,7 @@ static const json_object *extract_bytes_sent(request_rec *r, char *a)
77
}
88
}
99

10-
static const json_object *extract_request_time_custom(request_rec *r, char *a,
10+
json_object *extract_request_time_custom(request_rec *r, char *a,
1111
apr_time_exp_t *xt)
1212
{
1313
apr_size_t retcode;
@@ -27,7 +27,7 @@ typedef struct {
2727
#define TIME_CACHE_MASK 3
2828
static cached_request_time request_time_cache[TIME_CACHE_SIZE];
2929

30-
static const json_object *extract_request_time(request_rec *r, char *a)
30+
json_object *extract_request_time(request_rec *r, char *a)
3131
{
3232
apr_time_exp_t xt;
3333

@@ -82,14 +82,14 @@ static const json_object *extract_request_time(request_rec *r, char *a)
8282
}
8383
}
8484

85-
static const json_object *extract_request_duration(request_rec *r, char *a)
85+
json_object *extract_request_duration(request_rec *r, char *a)
8686
{
8787
apr_time_t duration = apr_time_now() - r->request_time;
8888
return json_object_new_int(apr_time_usec(duration));
8989
}
9090

91-
static const json_object *extract_connection_status(request_rec *r, char *a) __attribute__((unused));
92-
static const json_object *extract_connection_status(request_rec *r, char *a)
91+
json_object *extract_connection_status(request_rec *r, char *a) __attribute__((unused));
92+
json_object *extract_connection_status(request_rec *r, char *a)
9393
{
9494
if (r->connection->aborted)
9595
return json_object_new_string("X");

src/mod_log_gelf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ static apr_status_t log_gelf_connection_release(request_rec* r, gelf_connection
232232

233233
static apr_status_t log_gelf_get_gelf_connection(gelf_connection *gc, gelf_config *config, apr_pool_t *pool) {
234234
apr_status_t rv;
235-
int proto = NULL;
236-
int type = NULL;
235+
int proto = 0;
236+
int type = 0;
237237

238238
if (config->protocol == TCP) {
239239
proto = APR_PROTO_TCP;

src/mod_log_gelf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
typedef const json_object* item_func(request_rec *r, char *a);
1+
typedef json_object* item_func(request_rec *r, char *a);
22
typedef struct transferDataS {
33
void * data;
44
int size;

0 commit comments

Comments
 (0)