centos - How to start the Snort service with logging enabled?

07
2014-07
  • SLYN

    I setup snort on Centos server and add as a service. When I use service snortd start command, the log file is created but it is empty. If I use snort -q -l /var/log/snort command, the log file created and filled with logs. What should I do in order to use service snortd start and have the logs work?

  • Answers
  • Florin Stingaciu

    Edit the init file in /etc/init.d/snortd and add -q -l /var/log/snort to the command.


  • Related Question

    linux - How do I create a service using chkconfig in CentOS?
  • qroberts

    I want to be able to create a service so that the bash script will run every time the server boots up.

    I am running CentOS 5.

    I have been reading about chkconfig and creating a file in /etc/init.d for chkconfig to handle but I cannot seem to get it to work whenever I 'chkconfig servicename on' and then 'service servicename start'

    When I do chkconfig --list my service is listed there.

    Can someone provide me with a sample of the file I need to create in /etc/init.d and how to get everything running?


  • Related Answers
  • Linker3000

    If you just need a bash script to run one or more things every time the server starts, you can run the script from /etc/rc.local. Here's mine - it fires up my media server app by calling its startup script:

    #!/bin/sh
    #
    # This script will be executed *after* all the other init scripts.
    # You can put your own initialization stuff in here if you don't
    # want to do the full Sys V style init stuff.
    
    touch /var/lock/subsys/local
    
    #NK make sure nas is mounted:
    mount -a
    /etc/init.d/serviiod start
    
  • Patches

    There is an initscript template on the Fedora Project website.

    On the same page, below the template, are complete instructions for writing headers for initscripts on RedHat/Fedora/CentOS systems. You might need to do this if you need to ensure your script runs after other services are started, you only want the script to run in certain circumstances, or you want graphical system administration tools to display complete information about the script.