3 Replies Latest reply on Jan 12, 2016 11:16 AM by dmclean

    SQL Delete of Syslog entries

    Ralphr

      I had a single device generate alot of Syslog entries and I was going to just go into the DB and delete those entries associated with that device from the syslog table using SQL Delete. I know the recommendation from SW is normally to use the Truncate command to do this sort of thing.  Any reason I should not use SQL Delete directly ??

        • Re: SQL Delete of Syslog entries

          I can't think of any good reason not to do this.  I manage my syslog messages on a daily basis through this method.

          • Re: SQL Delete of Syslog entries
            Karlo.Zatylny

            Hi,

            TRUNCATE should only be used if you really need to get rid of all the data in your table, which is hopefully extremely rare.  If you want to get rid of Syslog entries from a specific node or IP address then use a DELETE statement.  Please only do this if you are very comfortable using SQL and do a backup of your table if you feel it is necessary before executing the statement.

            Best practice is to execute a SELECT statement first to see what you are going to be deleting:

            SELECT * FROM dbo.SysLog WHERE IP = '10.10.10.10'

            Noting the risks, a sample statement for this would be:

            DELETE FROM dbo.SysLog WHERE IP = '10.10.10.10'

            Replacing the IP address with the IP address of the Node that you want to remove the Syslog entries for.

            Deletes are permanent so please be aware of this and change the SQL if you need to narrow the scope of the delete. 

            Thanks