Audit Profile Error

Hi

I have started seeing this error show up in the console. It is been generated when a user is inserting a row into a table with various values of integer’s and strings. The row gets inserted but I am just wondering what might be causing it. I am using 7.2.7

Thanks

Aidan
[ERROR] 12:28:42 PM DatasourceAuditProfile Error auditing [DefaultAuditRecord[action=“query”, actionTarget=“INSERT INTO AutoStateMessage (AutoStateID,EquipID,EntryType,Duration,LineID,Shiftname,t_stamp,CauseText,WorkOrder,Box) VALUES (180, 33, 2, 60,3, ‘Day Shift’, ‘2012-01-23 09:00:00’,‘Process–FTDC empty.Waiting for to be filled ,also for the right temperature.’,‘0’,‘0’)”, actionValue=“1”, actor=“supervisor”, context=“4”, system=“project=TOLProductionMonitoring”, status=“StatusCode[Severity=Good, Subcode=NotSpecified, 0x00000000]”, timestamp=“Mon Jan 23 12:28:42 GMT 2012”]], due to underlying exception.

com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:196)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1454)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:388)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:338)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4026)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1416)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:185)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:160)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:306)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper$SRPreparedStatement.executeUpdate(SRConnectionWrapper.java:810)
at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper.runPrepUpdate(SRConnectionWrapper.java:139)
at com.inductiveautomation.ignition.gateway.audit.DatasourceAuditProfile.audit(DatasourceAuditProfile.java:181)
at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.AbstractUpdateQuery.auditUpdateQuery(AbstractUpdateQuery.java:52)
at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.AbstractUpdateQuery.run(AbstractUpdateQuery.java:34)
at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.AbstractDBAction.invoke(AbstractDBAction.java:77)
at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:389)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:85)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
Audit Error.txt (3.76 KB)

It means one of the strings in the insert query is more characters than the data type allows for on the AutoStateMessage table. I bet it has to do with the CauseText column. Go into your database and edit (alter) the AutoStateMessage table and look at the number of characters for the CauseText column (varchar(255) is 255 characters). You may need to increase it.

Hi Travis

I have the datatype set to VARCHAR (MAX) for the cause text column which I thought would be sufficient for typical text entry. It may be one of the other fields as they are not VARCHAR (max). I will check the others out

Thanks

Aidan

Hi

This problem starting happening on the blog notes table as well so I did a bit more trouble shooting and found that the audit events table was the reason the error was been thrown. The action target column is only 255 character by default while my inserts can be much larger than this. Setting it to varchar(max) resolved the problem

Aidan

Thanks for reporting the fix! :thumb_left: