Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running TheHive 4.0.1-1 it appears that application.log is no longer rotated. #1746

Closed
pitrh opened this issue Jan 13, 2021 · 4 comments
Closed
Assignees
Labels
TheHive4 TheHive4 related issues
Milestone

Comments

@pitrh
Copy link

pitrh commented Jan 13, 2021

Running TheHive 4.0.1-1 it appears that application.log is no longer rotated.

No changes made to the supplied logback.xml

How do I enable and/or debug the issue?

Originally posted by @pitrh in #579 (comment)

@nadouani nadouani added TheHive4 TheHive4 related issues need:investigation labels Jan 20, 2021
@nadouani nadouani added this to the 4.1.0 milestone Jan 20, 2021
@mphbig
Copy link

mphbig commented Feb 2, 2021

Hello, same issue here.

We implemented a workaround using rsyslog and logrotate.

/etc/thehive/logback.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
    <conversionRule conversionWord="coloredLevel"
        converterClass="play.api.libs.logback.ColoredLevel"/>

    <appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender">
        <syslogHost>localhost</syslogHost>
        <facility>LOCAL4</facility>
        <throwableExcluded>true</throwableExcluded>
        <suffixPattern>[%level] from %logger in %thread [%X{request}|%X{tx}] %message%n%xException</suffixPattern>
    </appender>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%coloredLevel %logger{15} [%X{request}|%X{tx}] %message%n%xException{10}</pattern>
        </encoder>
    </appender>

    <appender name="ASYNCSTDOUT" class="ch.qos.logback.classic.AsyncAppender">
        <appender-ref ref="STDOUT"/>
    </appender>

    <logger name="org.thp" level="INFO"/>

    <root level="INFO">
        <appender-ref ref="SYSLOG"/>
        <appender-ref ref="ASYNCSTDOUT"/>
    </root>

</configuration>

/etc/rsyslog.conf

$ModLoad imudp
$UDPServerAddress 127.0.0.1
$UDPServerRun 514

/etc/rsyslog.d/40-thehive.conf

local4.*        -/var/log/thehive/application.log

/etc/logrotate.d/thehive

/var/log/thehive/application.log
{
        rotate 20
        daily
        maxsize 250M
        compress
        nodelaycompress
        missingok
        notifempty
        create 660 root thehive
        postrotate
                invoke-rc.d rsyslog rotate > /dev/null
        endscript
}

@To-om To-om modified the milestones: 4.1.0, 4.0.5 Feb 3, 2021
@To-om
Copy link
Contributor

To-om commented Feb 3, 2021

@pitrh which package do you use (deb, rpm, zip, ...) ? Can you check if logback configuration file is used by TheHive (with the parameter -Dlogger.file=/etc/thehive/logback.xml) ?

@To-om
Copy link
Contributor

To-om commented Feb 3, 2021

I found a typo in logback.xml file. This is probably why logs are not rotated.

@pitrh
Copy link
Author

pitrh commented Feb 4, 2021

The package was the then-latest rpm --
$ sudo yum list installed | grep -i thehive
cortex.noarch 3.1.0-1 @TheHive-Project
thehive4.noarch 4.0.4-1 @TheHive-Project

Applying the changes indicated in the referenced commit followed by "sudo systemctl restart thehive" did get log rotation going.

Please see my comment on the commit, the local (untouched) logback-migration.xml differed from the "before" version referenced in the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TheHive4 TheHive4 related issues
Projects
None yet
Development

No branches or pull requests

4 participants