I want to add a Custom Nginx Configuration to my Proxy Host.
I've added the command
access_log /path/to/logfile.log proxy;
with success.
But now i want to change the output of the logfile.
I thought it is as easy as declare a new log_format into the Custom Configuration Window.
But when i try to add something like
log_format custom '$remote_addr - $remote_user';
the Status from this Proxy Hosts toggles from Online to Offline.
Is there a good solution to customize the log_format? Is it just a bug and it shoult be in general possible to edit the log_format in the Custom Nginx Configuration Window?
Best Regards
the project sets it's own log file format for some reason.
It would be nice to have the option of selecting one of the standard (apache/nginx/etc) ones, or overriding it entirely.
I go with that
To use the standard analyzer tools we need the standard log format
I honestly can't find a good reason for this project to have a non-standard log format by default. I've been fighting with telegraf and grok patterns (new stuff to me) for the better part of the afternoon just to get some metrics into Influx... just... why? I can't even find the source place where this is defined to change it before the container is configured.
@jc21 would adding the custom output format in one of the "advanced config" file appenders work?
EDIT: just to clarify, I have not been successful with grok, even though I'm using a constructor to help me, I still find that for most of my proxy hosts, the cache status is a dash so I can't make one pattern to rule them all (within my ability and patience right now).
the log_format definitions need to go into the base nginx.conf, the actual logging line can just go into the host definition. (so you can't just put it into the custom configuration inside the webUI, as you've discovered)
/etc/nginx/nginx.conf inside the docker container has log_format entries on lines 46/47
You can comment out these two lines and put in standard ("combined") log_format definitions - i don't have them handy, I'm at work, nginx docs should have the standard ones though!
make sure you name them correctly, the lines will need to start with "log_format proxy" and "log_format standard"
this does leave us an opening to define log_formats and then select which one we want per host inside the WebUI (and by "we" i mean someone else ;) )
Yes, editing /etc/nginx/nginx.conf works. It is also possible to add a line log_format customtemplate 'YOUROPTIONSHERE';
But wouldn't updating the container destroy changes made in /etc/nginx/nginx.conf?
Is there a way to change the log_format or set a custom log_format in the /data directory in the container?
I think I ended up putting /etc/nginx into a bind-mounted directory - changes persist through recreations - but if there's a huge change, it's likely to bite me.