[
https://issues.apache.org/jira/browse/SOLR-9570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jan Høydahl updated SOLR-9570:
------------------------------
Attachment: SOLR-8370.patch
Patch:
{noformat}
* SOLR-9570: Various log tidying now happens at Solr startup:
Old solr_log_<date> and solr_gc_log_<date> files are removed, avoiding disks
to fill up,
solr.log.X files are rotated, preserving solr.log from last run in
solr.log.1, solr.log.1 => solr.log.2 etc
solr-*-console.log files are moved into $SOLR_LOGS_DIR/archived/ instead of
being overwritten
Last JVM garbage collection log solr_gc.log is moved into
$SOLR_LOGS_DIR/archived/, overwriting previous (janhoy)
{noformat}
This adds a new {{UtilsTool}} to SolrCLI, which handles the tasks in Java code,
removing complexity from scripts. The scripts simply call the tool like this
{code}
run_tool utils -s "$DEFAULT_SERVER_DIR" -l "$SOLR_LOGS_DIR"
-remove_old_solr_logs 7 || echo "Failed removing old solr logs"
run_tool utils -s "$DEFAULT_SERVER_DIR" -l "$SOLR_LOGS_DIR" -archive_gc_logs
|| echo "Failed archiving old GC logs"
run_tool utils -s "$DEFAULT_SERVER_DIR" -l "$SOLR_LOGS_DIR"
-archive_console_logs || echo "Failed archiving old console logs"
run_tool utils -s "$DEFAULT_SERVER_DIR" -l "$SOLR_LOGS_DIR" -rotate_solr_logs 9
|| echo "Failed rotating old solr logs"
{code}
See patch for documentation of each tool option.
The tool {{-rotate_solr_logs <gen>}} in particular, is a workaround for backing
up {solr.log}}, in that it will rotate existing {{solr.log.N}} the same way
that log4j does. This code can be removed when we upgrade to newer log4j which
can handle this itself.
Potential issues:
* We now keep only the last {{solr_gc.log}} in {{logs/archived/}}, will be
overwritten on next start. However, this will be fixed in SOLR-7506 when we
introduce GC log rotation
* We now archive latest {{solr-NN-console.log}} into {{logs/archived/}}. This
is a 1-generation rotation only, and on two consecutive restarts only the last
run console log is kept. Earlier we kept timestamped logs forever...
Tested on OSX and on Windows 10. Further test and feedback welcome. I'll commit
this on thursday if all is sunshine :)
> Logs backed up on restart are kept forever
> ------------------------------------------
>
> Key: SOLR-9570
> URL: https://issues.apache.org/jira/browse/SOLR-9570
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Components: scripts and tools
> Reporter: Jan Høydahl
> Assignee: Jan Høydahl
> Labels: logging
> Fix For: 6.3, master (7.0)
>
> Attachments: SOLR-8370.patch
>
>
> When (re)starting Solr, the start script will backup any existing
> {{solr.log}} or {{solr_gc.log}} to a file {{solr_log_<date>}} and
> {{solr_gc_log_<date>}} respectively. That may be all good, but these old
> copies are never cleaned up, as they are not under the control of log4j.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]