Posts

Showing posts from July, 2021

Splunk 101

Filter API paths I have the following events which contain API request paths like the following, PUT /api/v1/apps/{id} PUT /api/v1/apps/{id}/users PUT /api/v1/apps/{id}/verify/{vid} and so on. I want only those events with the first pattern above, ie. PUT /api/v1/apps/{id} and want to discard the rest of the events. The splunk expression to use for this is, requestPath=/api/v1/apps/* PUT | regex requestPath="/api/v1/apps/([a-zA-Z0-9?]+)$" According to the splunk docs, use the regex command to filter out events, and  Use the  rex  command to either extract fields using regular expression named groups, or replace or substitute characters in a field using sed expressions. Notes requestPath is a field available in the event, so we use it with the regex command. Using a fieldName is optional and if you don't use it, the regex uses the default _raw field, which is the whole event. Extract path variables from API path Example You have an API - GET /app/{appName}/{appId}/users, ...

HTTP Accept vs Content-Type Header

 I am always confused between these 2 HTTP headers - which one is sent/consumed by the server and which one by the client? Accept Header The Accept header is set by the client to indicate the media type of the response that it can accept. Content-Type Header The Content-Type header is set by either on the request or the response, indicating the media type of the content of the current request. This header can be set by either client or the server, who ever is sending the request/response. Some notes about these headers - https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html has definitions of these and some other headers. - A server is not required to honor the Accept header. The RFC states that it should send a 406 if it cannot produce the response type requested in the Accept header, but not all servers honor this.

Notes On Designing Data-Intensive Applications

Chapter 7 Atomicity - deals with atomicity of an operation, ie, if an error occurs before transaction is committed, it should be rolled back. Isolation  - deals with isolating transactions on shared data to attain concurrency.

Dirty Reads and Dirty Writes

Dirty Read Data that has not been committed is read. Dirty Write Data that has not been committed is overwritten.

Database Normalization and Denormalization

I always keep confusing between normalization and denormalization. This is just a place I can come to to quickly lookup which one is which. Normalization - remove redundancy. Denormalization - add redundancy to make fetching data faster.