Answer the question
In order to leave comments, you need to log in
How to pull a variable from a syslog-ng log line?
How to make a message:
Jun 17 17:38:02 server2.test nginx: test.ru 192.168.1.121 - [17/Jun/2019:17:38:02 +0300] UNIX-TIME-1560782282.938 "GET / HTTP/1.1" 200
Answer the question
In order to leave comments, you need to log in
For some reason, it seems to me that I need to look in the direction of rsyslog)
I didn’t really understand how the syslog-ng source file is filled.
But for one-time parsing, you can make such a construction
#!/bin/bash
while read domain; do echo "$domain" | mkdir ~/var/log/`grep -Po '(?<=nginx:\s).+(\.\D\S{1,3})'` 2>/dev/null; done < syslog
while read string; do echo "$string" | echo "$string" >> ~/var/log/`grep -Po '(?<=nginx:\s).+(\.\D\S{1,3})'`/nginx_ac.log ; done < syslog
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question