Not able to see logs while implementing File based logging using message logging policy.

pranjalic
Participant II

I want to put my proxy logs in a local file and forward them to ELK. Currently I have changed the path in message_logging.properties file to a local file. Entry is as below

log.root.dir=/tmp/message_logging/test.log

But I am not seeing any logs there.

Also can anyone suggest how can we forward these logs to ELK. I have filebeat installed on my server.
@Siddharth Barahalikar you have any idea about this?

Solved Solved
1 7 564
1 ACCEPTED SOLUTION

rmishra
Participant V

I am wondering if it is a OS file permission issue.

Try creating the file manually, and then assigning the "apigee" user permissions to write into that file.

I am assuming that your message processor as the "apigee" user on the OS. If it is running as something else, give that user privileges to write into the log file.

Your message processor log should also tell you if it's a permission related issue.

View solution in original post

7 REPLIES 7

rmishra
Participant V

I am wondering if it is a OS file permission issue.

Try creating the file manually, and then assigning the "apigee" user permissions to write into that file.

I am assuming that your message processor as the "apigee" user on the OS. If it is running as something else, give that user privileges to write into the log file.

Your message processor log should also tell you if it's a permission related issue.

@rmishra thank you for your help. My messages are getting logged. But now I see only one log entry each time i make a request. Previous log entry is getting deleted. how can I append log entries and avoid deleting the older ones.

@Pranjali,

Can you please check the FileRotationOptions in your MessageLogging policy ?

Alternatively add the MessageLogging policy to this post, we will check and get back to you if there's any issue with the settings.

You can read more about FileRotationOptions here.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <MessageLogging async="false" continueOnError="false" enabled="true" name="MessageLogging"> <DisplayName>MessageLogging</DisplayName> <File> <!-- <Message>This is a test message. Message id = {request.header.id:unknown}</Message>!--> <Message>This is a test message. Message id = {request.header.host:unknown}</Message> <FileName>/tmp/message_logging/test.log</FileName> <FileRotationOptions rotateFileOnStartup="true"> <FileRotationType>SIZE</FileRotationType> <MaxFileSizeInMB>50</MaxFileSizeInMB> <MaxFilesToRetain>10</MaxFilesToRetain> </FileRotationOptions> </File> <logLevel>INFO</logLevel> </MessageLogging>

@Pranjali,

I don't see any issues with your MessageLogging policy as such.

Can you please check the MessageProcessor logs and see if there are any errors or messages related to log rotation ?

messages are getting logged now. But I am not able to put a timestamp in my log file though I setup the below property on message-processor.properties

conf_system_apigee.syslogger.dateFormat=yy/MM/dd'T'HH:mm:ss.sssZ

@Pranjali,

can you please try this out and see if it resolves the issue ?

1. Add the following line in the file /opt/apigee/customer/application/message-processor.properties :

conf_system_apigee.syslogger.dateFormat=yyyy-MM-dd'T'HH:mm:ss.sssZ


2. Restart message-processors.

If the problem persists, check if there are any errors/exceptions in the Message Processor's log file /opt/apigee/var/log/edge-message-processor/logs/system.log and share the details.