-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path51-reverse-proxy.conf
36 lines (32 loc) · 1.46 KB
/
51-reverse-proxy.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# capture file events
module(load="imfile")
# The imfile module will wait for new loglines in the given file
# Tag is recommended and relevant especially while hosting multiple websites in one server.
input(type="imfile"
File="/var/log/nginx/reverse-access.log"
Tag="mywebsite:")
# Load the ompgsql output module for sending logs to PostgreSQL server
module(load="ompgsql")
# To insert a log as one row of table, a template is needed.
# The template below will determine how to insert a row in table named as accesslog.
# The json log output as defined in Nginx configuration will be inserted in log_line json column.
# The creation timestamp will be inserted to column created_at.
template(name="pgsql-template" type="list" option.sql="on") {
constant(value="INSERT INTO accesslog (log_line, created_at) values ('")
property(name="msg")
constant(value="','")
property(name="timereported" dateformat="pgsql" date.inUTC="on")
constant(value="')")
}
# The following action determines the event to be triggered when a new logline is detected by imfile module.
# Based on the tag defined above, it will insert the log to the PostgreSQL database.
# Credentials of the database are needed here.
# The template name should be the same as defined above.
if( $syslogtag == 'mywebsite:') then {
action(type="ompgsql" server="localhost"
user="user1"
pass="password"
db="proxy_logs"
template="pgsql-template"
queue.type="linkedList")
}