Log System: Thoughts on field types-string, datetime, IP, Int, float)

Source: Internet
Author: User

Logs are used to record events. Therefore, the log content should include:

Event Date and Time:
Precision: Millisecond (the most common time unit in Java), microsecond (commonly used time units in other languages such as PHP), and nanoseconds;
Type: datetime, double, long ,,,

Event subject
Type: String

Event object
Type: String

Event Description
Type: String

Event Type
Type: int, String ,,,

Event level:
Type: int, string

IP address or name of the Log Data source:
Type: IP, string

Summary: int, long, double, String, IP, datetime

If you consider extreme values, you should

An integer greater than long, that is, bigint;

Supports floating-point numbers larger than double, that is, bigdecimal;

Consider the storage space.

Should support a smaller unit, byte, short

Finally, we should consider the complexity.

Use as few types as possible and as simple as possible:String, datetime, IP, Int, float ).
The maximum value does not appear normally. It can be treated as an exception! Or use string for processing.

 

Log System: Thoughts on field types-string, datetime, IP, Int, float)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.